On 05/10/12 08:10, Eugenio Bargiacchi wrote:
> Good day, I'm having a small problem when compiling FLTK programs from my ide 
> ( Code::Blocks on Windows 7 ).
> 
> In particular, when I try to compile with the command line provided by the 
> fltk-config --compile it all works, while when I compile from my IDE I get 
> this error:
> 
> lib/libfltk.a(Fl_Native_File_Chooser.o):Fl_Native_File_Chooser.cxx:(.text+0x1556):
>  undefined reference to `__chkstk_ms'
> 
> These are the two command lines, for comparing:
> 
> WORKING:
> g++ -I..\fltk-1.3.0\ -mwindows -DWIN32 -DUSE_OPENGL32 -D_LARGEFILE_SOURCE 
> -D_LARGEFILE64_SOURCE -o 'main' main.cpp -mwindows 
> ..\fltk-1.3.0\lib\libfltk.a -lole32 -luuid -lcomctl32
> 
> NOT WORKING:
> 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
> 
> My IDE does the linking after the compiling, but I think this shouldn't be a 
> problem? What am I missing?

        I would suggest going outside the IDE and play around with those last
        two compile + link lines in a terminal window until you get it to work,
        then tweak your IDE to use the correct commands.

        First, I'd suggest removing the -fexceptions from your compile line.
        That might make the build different enough from the fltk lib's build
        to cause link issues.
        
        Also, as an aside, I'd suggest trying an absolute path to the libfltk.a
        file instead of using the -L/-lfltk combo, eg:

OLD: 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
NEW: mingw32-g++.exe -o bin\Debug\test.exe obj\Debug\main.o -mwindows 
C:\Users\Svalorzen\Documents\Projects\fltk-1.3.0\lib\libfltk.a -lole32 -luuid 
-lcomctl32

        This seems to ensure a static link against the .a (as opposed to the 
.so/.dll)
_______________________________________________
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to