Author Topic: Compiles fine but always encounters problem when running the .exe  (Read 6140 times)

Offline lifeisgood

  • Single posting newcomer
  • *
  • Posts: 7
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?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Compiles fine but always encounters problem when running the .exe
« Reply #1 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

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

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

Tim S.
« Last Edit: March 27, 2017, 07:35:49 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline lifeisgood

  • Single posting newcomer
  • *
  • Posts: 7
Re: Compiles fine but always encounters problem when running the .exe
« Reply #2 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

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

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

Tim S.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Compiles fine but always encounters problem when running the .exe
« Reply #3 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

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

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

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.
« Last Edit: March 27, 2017, 07:51:47 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline lifeisgood

  • Single posting newcomer
  • *
  • Posts: 7
Re: Compiles fine but always encounters problem when running the .exe
« Reply #4 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.
« Last Edit: March 27, 2017, 08:14:48 pm by lifeisgood »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Compiles fine but always encounters problem when running the .exe
« Reply #5 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.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline yvesdm3000

  • Almost regular
  • **
  • Posts: 225
Re: Compiles fine but always encounters problem when running the .exe
« Reply #6 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
Clang based code completion for Code::Blocks:   http://github.com/yvesdm3000/ClangLib

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Compiles fine but always encounters problem when running the .exe
« Reply #7 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.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline lifeisgood

  • Single posting newcomer
  • *
  • Posts: 7
Re: Compiles fine but always encounters problem when running the .exe
« Reply #8 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.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Compiles fine but always encounters problem when running the .exe
« Reply #9 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.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Compiles fine but always encounters problem when running the .exe
« Reply #10 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.
 
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Compiles fine but always encounters problem when running the .exe
« Reply #11 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.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline lifeisgood

  • Single posting newcomer
  • *
  • Posts: 7
Re: Compiles fine but always encounters problem when running the .exe
« Reply #12 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.