Code::Blocks Forums

User forums => Help => Topic started by: lifeisgood on March 27, 2017, 07:16:27 pm

Title: Compiles fine but always encounters problem when running the .exe
Post by: lifeisgood on March 27, 2017, 07:16:27 pm
Hi, I downloaded and installed codeblocks-16.01mingw-setup.exe for my Windows 10 computer. When I compiled the code it was fine but when I tried to run it there was always a problem with alloc_traits.h. When someone else used the g++ or the cl.exe compilers from the command line they got output with no problem. Does anyone know what the issue is here, please?
Title: Re: Compiles fine but always encounters problem when running the .exe
Post by: stahta01 on March 27, 2017, 07:32:54 pm
My best guess on the little information you posted is that you made a programming mistake.

Please read and follow the rules http://forums.codeblocks.org/index.php/topic,9996.0.html (http://forums.codeblocks.org/index.php/topic,9996.0.html)

Please report problems with the information need to have a chance on helping you.
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F (http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F)

Edit: Added third link that might be the issue: http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_I_get_a_blank_.28black.29_terminal_window_on_windows (http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_I_get_a_blank_.28black.29_terminal_window_on_windows)

Tim S.
Title: Re: Compiles fine but always encounters problem when running the .exe
Post by: lifeisgood on March 27, 2017, 07:39:44 pm
Hi Tim, My friend and I checked over and over to make sure that the program had no problem and it ran fine on his computer...

My best guess on the little information you posted is that you made a programming mistake.

Please read and follow the rules http://forums.codeblocks.org/index.php/topic,9996.0.html (http://forums.codeblocks.org/index.php/topic,9996.0.html)

Please report problems with the information need to have a chance on helping you.
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F (http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F)

Edit: Added third link that might be the issue: http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_I_get_a_blank_.28black.29_terminal_window_on_windows (http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_I_get_a_blank_.28black.29_terminal_window_on_windows)

Tim S.
Title: Re: Compiles fine but always encounters problem when running the .exe
Post by: stahta01 on March 27, 2017, 07:47:07 pm
Hi Tim, My friend and I checked over and over to make sure that the program had no problem and it ran fine on his computer...

My best guess on the little information you posted is that you made a programming mistake.

Please read and follow the rules http://forums.codeblocks.org/index.php/topic,9996.0.html (http://forums.codeblocks.org/index.php/topic,9996.0.html)

Please report problems with the information need to have a chance on helping you.
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F (http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F)

Edit: Added third link that might be the issue: http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_I_get_a_blank_.28black.29_terminal_window_on_windows (http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_I_get_a_blank_.28black.29_terminal_window_on_windows)

Tim S.

So there is no problem; so, we all can ignore your request for help.

Edit: This is the only logical conclusion since you refuse to provide any real info needed to help you.

Tim S.
Title: Re: Compiles fine but always encounters problem when running the .exe
Post by: lifeisgood on March 27, 2017, 08:05:36 pm
All I was trying to say was that programming mistake might be able to rule out... This is what I got from the compiler:

Quote
-------------- Clean: Debug in Tauchen (compiler: GNU GCC Compiler)---------------

Cleaned "Tauchen - Debug"

-------------- Build: Debug in Tauchen (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Wall -g  -c E:\BC\Courses\Pablo_Methods\HW\HW1\Tauchen.cpp -o obj\Debug\Tauchen.o
mingw32-g++.exe  -o bin\Debug\Tauchen.exe obj\Debug\Tauchen.o   
Output file is bin\Debug\Tauchen.exe with size 1.08 MB
Process terminated with status 0 (0 minute(s), 4 second(s))
0 error(s), 0 warning(s) (0 minute(s), 4 second(s))
 

I also tried compiling it from the command line and got the following message after trying to run the .exe file. This is the exact same message I got from running the above .exe file.
Quote
terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more infomration.
Title: Re: Compiles fine but always encounters problem when running the .exe
Post by: stahta01 on March 27, 2017, 08:13:40 pm
So you got a bad compiler or bad code; we do NOT support the Compiler and we do NOT support your code!

Tim S.
Title: Re: Compiles fine but always encounters problem when running the .exe
Post by: yvesdm3000 on March 27, 2017, 08:24:26 pm
All I was trying to say was that programming mistake might be able to rule out... This is what I got from the compiler:

Quote
-------------- Clean: Debug in Tauchen (compiler: GNU GCC Compiler)---------------

Cleaned "Tauchen - Debug"

-------------- Build: Debug in Tauchen (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Wall -g  -c E:\BC\Courses\Pablo_Methods\HW\HW1\Tauchen.cpp -o obj\Debug\Tauchen.o
mingw32-g++.exe  -o bin\Debug\Tauchen.exe obj\Debug\Tauchen.o   
Output file is bin\Debug\Tauchen.exe with size 1.08 MB
Process terminated with status 0 (0 minute(s), 4 second(s))
0 error(s), 0 warning(s) (0 minute(s), 4 second(s))
 

I also tried compiling it from the command line and got the following message after trying to run the .exe file. This is the exact same message I got from running the above .exe file.
Quote
terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more infomration.

The stdc++ library delivered with your compiler is probably not in your path. It's probably not installed correctly. As a workaround you might try to copy that dll next to your .exe file

Yves
Title: Re: Compiles fine but always encounters problem when running the .exe
Post by: stahta01 on March 27, 2017, 08:30:54 pm
All I was trying to say was that programming mistake might be able to rule out... This is what I got from the compiler:

Quote
-------------- Clean: Debug in Tauchen (compiler: GNU GCC Compiler)---------------

Cleaned "Tauchen - Debug"

-------------- Build: Debug in Tauchen (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Wall -g  -c E:\BC\Courses\Pablo_Methods\HW\HW1\Tauchen.cpp -o obj\Debug\Tauchen.o
mingw32-g++.exe  -o bin\Debug\Tauchen.exe obj\Debug\Tauchen.o   
Output file is bin\Debug\Tauchen.exe with size 1.08 MB
Process terminated with status 0 (0 minute(s), 4 second(s))
0 error(s), 0 warning(s) (0 minute(s), 4 second(s))
 

I also tried compiling it from the command line and got the following message after trying to run the .exe file. This is the exact same message I got from running the above .exe file.
Quote
terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more infomration.

The stdc++ library delivered with your compiler is probably not in your path. It's probably not installed correctly. As a workaround you might try to copy that dll next to your .exe file

Yves

Thank you for helping the OP.

I hate playing 20 question especially when I think the problem violates the rules of this site.
NOTE: Yves post implies that the problem should NOT have happened under Code::Blocks; but, would have happened when running from the command line. No idea if this is a fault of Code::Blocks IDE, the compiler, or CB Toolchain configuration error.

Tim S.
Title: Re: Compiles fine but always encounters problem when running the .exe
Post by: lifeisgood on March 27, 2017, 09:12:15 pm

Thank you for helping the OP.

I hate playing 20 question especially when I think the problem violates the rules of this site.
NOTE: Yves post implies that the problem should NOT have happened under Code::Blocks; but, would have happened when running from the command line. No idea if this is a fault of Code::Blocks IDE, the compiler, or CB Toolchain configuration error.

Tim S.

The problem happened in both cases. I did post the library file into the .exe file folder but there was still the problem of
Quote
terminate called after throwing an instance of 'std::bad_alloc' what():
 std::bad_alloc This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.
The compiler was installed prepackaged with Code Blocks because I used the codeblocks-16.01mingw-setup.exe for Windows. Maybe I will delete the previous instance of MinGW I previously installed and re-install codeblocks.
Title: Re: Compiles fine but always encounters problem when running the .exe
Post by: stahta01 on March 27, 2017, 09:31:13 pm
You have yet to state any information on the Compiler you think you are using!

Note: Nobody likely knows what compiler you are really using.

Post the CB Toolchain information and we will at least know what Compiler CB is set to use.

Tim S.
Title: Re: Compiles fine but always encounters problem when running the .exe
Post by: stahta01 on March 27, 2017, 09:35:58 pm
Maybe I will delete the previous instance of MinGW I previously installed and re-install codeblocks.

Yes, you should do this two MinGW GCC installation can cause issues; depending on the paths they are installed into.

Tim S.
 
Title: Re: Compiles fine but always encounters problem when running the .exe
Post by: stahta01 on March 29, 2017, 07:42:23 pm
What you really need to do is compile the source code from the command line to verify the problem is NOT in the compiler or the source code. Right now, the problem looks to have nothing to do with the Code::Blocks IDE.

Tim S.
Title: Re: Compiles fine but always encounters problem when running the .exe
Post by: lifeisgood on June 05, 2017, 03:40:56 pm
Turned out it was because my inputs had commas that didn't belong in there - what a stupid way for me to have wasted my own time and time of other people  :o ??? ::)

What you really need to do is compile the source code from the command line to verify the problem is NOT in the compiler or the source code. Right now, the problem looks to have nothing to do with the Code::Blocks IDE.

Tim S.