News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Modification causes program to crash

Started by zachris, April 14, 2015, 03:51:47 PM

Previous topic - Next topic

zachris

I am running Code::Blocks version 13.12 rev 9501 on MyOperatingSystem
Windows7. The compiler I use is MinGW32 (the one that installed with Code::Blocks)

When I ...

I have a set of code that use to compile and run. But now, it compiles but does not run. I do not know why.

Description of problem.
I can copy a old (backup version) of the code to my programming directory. I load this project into Code::Blocks and it compiles and runs just fine. However, if I modify anything in the code (such as merely adding a comment) the code will compile, but the program will not run.

I am new to Code::Blocks (been using it for about 2 weeks without problems as I develop this program). The problem I describe started yesterday morning.

I accept that this is probably a problem with how I am using Code::Blocks, but I cannot think of anything that I am doing differently today from what I was doing last week. If there is something on the wiki, or this forum, that describes this problem I have not found it (perhaps because the description of the problem defies a simple title).

Build log for when  the program compiles and but does not run:

-------------- Clean: Debug in test (compiler: GNU GCC Compiler)---------------

Cleaned "test - Debug"

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

mingw32-g++.exe -Wall -fexceptions -g -march=corei7-avx -O3 -Wfloat-equal -Wmissing-include-dirs -Wswitch-enum -std=c++11 -Wfatal-errors -Wall -IC:\GnuWin32\include -c "D:\__GNU analyze\biomechanics.cpp" -o obj\Debug\biomechanics.o
mingw32-g++.exe -Wall -fexceptions -g -march=corei7-avx -O3 -Wfloat-equal -Wmissing-include-dirs -Wswitch-enum -std=c++11 -Wfatal-errors -Wall -IC:\GnuWin32\include -c "D:\__GNU analyze\CommonFunctions.cpp" -o obj\Debug\CommonFunctions.o
mingw32-g++.exe -Wall -fexceptions -g -march=corei7-avx -O3 -Wfloat-equal -Wmissing-include-dirs -Wswitch-enum -std=c++11 -Wfatal-errors -Wall -IC:\GnuWin32\include -c "D:\__GNU analyze\InputOutput.cpp" -o obj\Debug\InputOutput.o
mingw32-g++.exe -Wall -fexceptions -g -march=corei7-avx -O3 -Wfloat-equal -Wmissing-include-dirs -Wswitch-enum -std=c++11 -Wfatal-errors -Wall -IC:\GnuWin32\include -c "D:\__GNU analyze\LocalError.cpp" -o obj\Debug\LocalError.o
mingw32-g++.exe -Wall -fexceptions -g -march=corei7-avx -O3 -Wfloat-equal -Wmissing-include-dirs -Wswitch-enum -std=c++11 -Wfatal-errors -Wall -IC:\GnuWin32\include -c "D:\__GNU analyze\main.cpp" -o obj\Debug\main.o
D:\__GNU analyze\main.cpp:54:1: warning: "/*" within comment [-Wcomment]
mingw32-g++.exe -Wall -fexceptions -g -march=corei7-avx -O3 -Wfloat-equal -Wmissing-include-dirs -Wswitch-enum -std=c++11 -Wfatal-errors -Wall -IC:\GnuWin32\include -c "D:\__GNU analyze\mathvalues.cpp" -o obj\Debug\mathvalues.o
mingw32-g++.exe -Wall -fexceptions -g -march=corei7-avx -O3 -Wfloat-equal -Wmissing-include-dirs -Wswitch-enum -std=c++11 -Wfatal-errors -Wall -IC:\GnuWin32\include -c "D:\__GNU analyze\Matrix.cpp" -o obj\Debug\Matrix.o
D:\__GNU analyze\Matrix.cpp: In function 'void SVD(const Matrix&, Matrix&, Matrix&, Matrix&)':
D:\__GNU analyze\Matrix.cpp:1988:36: warning: comparing floating point with == or != is unsafe [-Wfloat-equal]
D:\__GNU analyze\Matrix.cpp:2057:14: warning: comparing floating point with == or != is unsafe [-Wfloat-equal]
mingw32-g++.exe -Wall -fexceptions -g -march=corei7-avx -O3 -Wfloat-equal -Wmissing-include-dirs -Wswitch-enum -std=c++11 -Wfatal-errors -Wall -IC:\GnuWin32\include -c "D:\__GNU analyze\readwritedata.cpp" -o obj\Debug\readwritedata.o
mingw32-g++.exe -Wall -fexceptions -g -march=corei7-avx -O3 -Wfloat-equal -Wmissing-include-dirs -Wswitch-enum -std=c++11 -Wfatal-errors -Wall -IC:\GnuWin32\include -c "D:\__GNU analyze\Statistics.cpp" -o obj\Debug\Statistics.o
mingw32-g++.exe -LD:\GnuWin32\lib -o bin\Debug\test.exe obj\Debug\biomechanics.o obj\Debug\CommonFunctions.o obj\Debug\InputOutput.o obj\Debug\LocalError.o obj\Debug\main.o obj\Debug\mathvalues.o obj\Debug\Matrix.o obj\Debug\readwritedata.o obj\Debug\Statistics.o   C:\GnuWin32\lib\libgsl.a C:\GnuWin32\lib\libgsl.dll.a C:\GnuWin32\lib\libgslcblas.a C:\GnuWin32\lib\libgslcblas.dll.a
Output file is bin\Debug\test.exe with size 2.57 MB
Process terminated with status 0 (0 minute(s), 15 second(s))
0 error(s), 3 warning(s) (0 minute(s), 15 second(s))


-------------- Run: Debug in test (compiler: GNU GCC Compiler)---------------

Checking for existence: D:\__GNU analyze\test\bin\Debug\test.exe
Executing: "C:\CodeBlocks/cb_console_runner.exe" "D:\__GNU analyze\test\bin\Debug\test.exe"  (in D:\__GNU analyze\test\.)



Crash report:
The program fails to run, with the following statement:
Process returned -107374195 (0xC000001d)   execution time: 3.682 s

I have already tried ...
List of attempted solutions.
... but none of them worked.

I have an old version of the code that I copy entirely into my "programming" directory. This version of the code will compile and run just fine. However, if I modify anything – even adding a comment – the code will compile, but fail to run.

scarphin

Did you try to run the compiled executable from the command line (cmd.exe)? Does it work when run from the command line?

zachris

Yes, it compiles and runs from the command line.

This is the way I am progressing with the program. But having to go to the command line to compile and run defeats the purpose of an IDE.

stahta01

#3
Quote from: zachris on April 14, 2015, 04:58:46 PM
Yes, it compiles and runs from the command line.

This is the way I am progressing with the program. But having to go to the command line to compile and run defeats the purpose of an IDE.

Did you use the exact some options?

EDIT: Most people never use these two options "-g"  "-O3" at the same time.

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

zachris

I am not sure if I used the same options. I do not know how to set them in Code::Blocks.

However, since I do not know how to alter them I am fairly sure that I did not change options within Code::Blocks.

Still, this compiling and running from the command line does not explain why I was able to compile and run before, but now can seemingly compile but cannot run (or only run in a way that causes a crash).


stahta01

THE BAD OPTIONS DID NOT SET THEMSELVES!!!

Learn how to use your Tools! Its a poor worker who blames their tools for their problems.

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

osdt

Quote from: zachris on April 14, 2015, 03:51:47 PM
I can copy a old (backup version) of the code to my programming directory. I load this project into Code::Blocks and it compiles and runs just fine.

Maybe you're running the old (backup) executable?

Quote from: zachris on April 14, 2015, 03:51:47 PM
mingw32-g++.exe -Wall -fexceptions -g -march=corei7-avx -O3 -Wfloat-equal -Wmissing-include-dirs -Wswitch-enum -std=c++11 -Wfatal-errors -Wall -IC:\GnuWin32\include -c "D:\__GNU analyze\biomechanics.cpp" -o obj\Debug\biomechanics.o
...
Process returned -107374195 (0xC000001d)   execution time: 3.682 s

The error-code could be caused by an unhandled exception (illegal instruction?). Does your CPU support AVX instructions? If not, remove the option '-march=corei7-avx' (and -O3 for debug builds).


zachris

I'm not running an old backup executable -- I do not back up the executable.

My CPU does support AVX instructions, and this option has been in place for both the working a non-working versions of the code. Nonetheless, I tried switching off that option. It does not make a difference in the outcome.

The bottom line here is that I do not (did not) change anything with CodeBlocks. I merely edited the program code and even removed the edits. The code then compiles, but the program does not run.

BlueHazzard

what was your exact command when you compiled it with command line, so that it worked?

stahta01

Quote from: BlueHazzard on April 14, 2015, 07:15:12 PM
what was your exact command when you compiled it with command line, so that it worked?

FYI: They are likely linking to very old binary that might NOT work with a newer version of MinGW GCC.
Quote
11 July 2006
From http://gnuwin32.sourceforge.net/packages/gsl.htm

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]