0

I'm having quite a bit of trouble linking a test project of FLTK I'm doing on Code::Blocks, Windows 7.

After spending quite a lot of time understanding how to put the libraries in the correct order, I managed to get the project nearly done. However there's still a linking problem:

mingw32-g++.exe -Wall -fexceptions  -IC:\Users\Svalorzen\Documents\Projects\fltk-1.3.0 -mwindows -DWIN32 -DUSE_OPENGL32 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE     -c C:\Users\Svalorzen\Documents\Projects\test\main.cpp -o obj\Debug\main.o
mingw32-g++.exe  -o bin\Debug\test.exe obj\Debug\main.o   -LC:\Users\Svalorzen\Documents\Projects\fltk-1.3.0\lib -mwindows -lfltk -lole32 -luuid -lcomctl32  
C:\Users\Svalorzen\Documents\Projects\fltk-1.3.0\lib/libfltk.a(Fl_Native_File_Chooser.o):Fl_Native_File_Chooser.cxx:(.text+0x1556): undefined reference to `__chkstk_ms'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 1 seconds)
1 errors, 0 warnings

However, using the same exact script that Code::Blocks shows, executed on command prompt ( or even msys for what matters ), correctly compiles and links everything. The resulting exe also works.

C:\Users\Svalorzen\Documents\Projects\test>mingw32-g++ -Wall -fexceptions -IC:\Users\Svalorzen\Documents\Projects\fltk-1.3.0 -mwindows -DWIN32 -DUSE_OPENGL32 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -c C:\Users\Svalorzen\Documents\Projects\test\main.cpp -o obj\Debug\main.o

C:\Users\Svalorzen\Documents\Projects\test>mingw32-g++ -o bin\Debug\test.exe obj\Debug\main.o -LC:\Users\Svalorzen\Documents\Projects\fltk-1.3.0\lib -mwindows -lfltk -lole32 -luuid -lcomctl32

C:\Users\Svalorzen\Documents\Projects\test>dir bin\Debug\test.exe
   Volume in drive C has no label.
   Volume Serial Number is 00E8-6659

Directory of C:\Users\Svalorzen\Documents\Projects\test\bin\Debug

10/05/2012  19:01           661.087 test.exe
           1 File(s)        661.087 bytes
           0 Dir(s)  66.016.849.920 bytes free

The paths in the instruction are all absolute, so I don't really understand why this is.

What am I doing wrong? What I should check?

EDIT: It turned out that I had a MinGW installation I didn't remember about and Code::Blocks was using that one. I changed it and now everything is fixed.

Svalorzen
  • 5,353
  • 3
  • 30
  • 54

2 Answers2

0

If your MinGW is up-to-date, then try adding -no-vcproj and -no-dsp and then run mingw32-make confclean.

DejanLekic
  • 18,787
  • 4
  • 46
  • 77
0

It turned out that I had a MinGW installation I didn't remember about and Code::Blocks was using that one.

I setup Code::Blocks with the same compiler that created the library and now everything is fine.

Svalorzen
  • 5,353
  • 3
  • 30
  • 54