Author Topic: How to Configure a FLTK Project in SEPRO 2019 Windows - SOLVED  (Read 1851 times)

Allan

  • Community Member
  • Posts: 26
  • Hero Points: 1
How to Configure a FLTK Project in SEPRO 2019 Windows - SOLVED
« on: February 26, 2020, 05:12:28 AM »
I am trying to compile and build a FLTK Hello World program (https://www.fltk.org/doc-1.3/basics.html#basics_standard_compiler) using MSYS's g++ compiler, but I'm getting undefined error messages when doing a build.  For example,
   
Quote
undefined reference to `__imp_OleInitialize'
For a complete listing see my build output below. 
My Project Properties settings are:
  • Directories tab:  I have set the include directory for FLTK to C:\ProgramFiles\msys64\mingw64\include\FL\
  • Compile/Link tab:  I set the Libraries/Objects to:
C:\ProgramFiles\msys64\mingw64\lib\libfltk.aC:\ProgramFiles\msys64\mingw64\lib\libfltk.dll.a
C:\ProgramFiles\msys64\mingw64\lib\libfltk_forms.aC:\ProgramFiles\msys64\mingw64\lib\libfltk_forms.dll.a
C:\ProgramFiles\msys64\mingw64\lib\libfltk_gl.aC:\ProgramFiles\msys64\mingw64\lib\libfltk_gl.dll.a
C:\ProgramFiles\msys64\mingw64\lib\libfltk_images.aC:\ProgramFiles\msys64\mingw64\lib\libfltk_images.dll.a
   
I am able to compile and build my single file project on the command-line using fltk-config as follows:
Code: [Select]
$ fltk-config --compile fltk_mingw_test.cppThis command generates the following compile/link flags as output as well as an exe [fltk_mingw_test.exe] that runs:
Code: [Select]
x86_64-w64-mingw32-g++ -I/mingw64/include -mwindows -DWIN32 -DUSE_OPENGL32 -march=x86-64 -mtune=generic -O2 -pipe -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o 'fltk_mingw_test' 'fltk_mingw_test.cpp' -mwindows -pipe -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc /mingw64/lib/libfltk.a -lole32 -luuid -lcomctl32My questions are:  What am I doing wrong?  What am I not doing that I need to be doing?
Code: [Select]
***** START OF BUILD OUTPUT *****
e: & cd e:\Dev\fltk_mingw_test

e:\Dev\fltk_mingw_test>echo VSLICKERRORPATH="e:\Dev\fltk_mingw_test"
VSLICKERRORPATH="e:\Dev\fltk_mingw_test"

e:\Dev\fltk_mingw_test>"C:\PROGRA~1\SLICKE~1.1\win\vsbuild" "e:\Dev\fltk_mingw_test\fltk_mingw_test.vpw" "e:\Dev\fltk_mingw_test\fltk_mingw_test.vpj" -t build -signal 59162
---------- 'build' Project: 'fltk_mingw_test.vpj' - 'Debug' ---------- VSLICKERRORPATH="e:\Dev\fltk_mingw_test"
Compile/Link command change detected.  Some files may be rebuilt.
fltk_mingw_test.cpp
Using built-in specs.
COLLECT_GCC=C:\ProgramFiles\msys64\mingw64\bin\g++.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-9.2.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++ --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts=yes --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --enable-plugin --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev2, Built by MSYS2 project' --with-bugurl=https://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld
Thread model: posix
gcc version 9.2.0 (Rev2, Built by MSYS2 project)
COLLECT_GCC_OPTIONS='-c' '-v' '-g' '-Wall' '-Werror' '-mwindows' '-D' 'WIN32' '-D' 'USE_OPENGL32' '-march=x86-64' '-mtune=generic' '-O2' '-pipe' '-D' '_LARGEFILE_SOURCE' '-D' '_LARGEFILE64_SOURCE' '-D' '_FILE_OFFSET_BITS=64' '-o' 'e:/Dev/fltk_mingw_test/Debug/fltk_mingw_test.o' '-I' 'C:/ProgramFiles/msys64/mingw64/include/FL' '-shared-libgcc'
C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/cc1plus.exe -quiet -v -I C:/ProgramFiles/msys64/mingw64/include/FL -iprefix C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/ -D_REENTRANT -D WIN32 -D USE_OPENGL32 -D _LARGEFILE_SOURCE -D _LARGEFILE64_SOURCE -D _FILE_OFFSET_BITS=64 fltk_mingw_test.cpp -quiet -dumpbase fltk_mingw_test.cpp -mwindows -march=x86-64 -mtune=generic -auxbase-strip e:/Dev/fltk_mingw_test/Debug/fltk_mingw_test.o -g -O2 -Wall -Werror -version -o - |
C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/as.exe -v -I C:/ProgramFiles/msys64/mingw64/include/FL -o e:/Dev/fltk_mingw_test/Debug/fltk_mingw_test.o
GNU C++14 (Rev2, Built by MSYS2 project) version 9.2.0 (x86_64-w64-mingw32)
compiled by GNU C version 9.2.0, GMP version 6.1.2, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.21-GMP

warning: GMP header version 6.1.2 differs from library version 6.2.0.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "C:/ProgramFiles/msys64/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../include/c++/9.2.0"
ignoring duplicate directory "C:/ProgramFiles/msys64/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../include/c++/9.2.0/x86_64-w64-mingw32"
ignoring duplicate directory "C:/ProgramFiles/msys64/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../include/c++/9.2.0/backward"
ignoring duplicate directory "C:/ProgramFiles/msys64/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/9.2.0/include"
ignoring nonexistent directory "C:/building/msys64/mingw64/include"
ignoring nonexistent directory "/mingw64/include"
ignoring duplicate directory "C:/ProgramFiles/msys64/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/9.2.0/include-fixed"
ignoring duplicate directory "C:/ProgramFiles/msys64/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/include"
ignoring nonexistent directory "C:/building/msys64/mingw64/x86_64-w64-mingw32/include"
#include "..." search starts here:
#include <...> search starts here:
C:/ProgramFiles/msys64/mingw64/include/FL
C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../include/c++/9.2.0
C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../include/c++/9.2.0/x86_64-w64-mingw32
C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../include/c++/9.2.0/backward
C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/include
C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../include
C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/include-fixed
C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/include
End of search list.
GNU C++14 (Rev2, Built by MSYS2 project) version 9.2.0 (x86_64-w64-mingw32)
compiled by GNU C version 9.2.0, GMP version 6.1.2, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.21-GMP

warning: GMP header version 6.1.2 differs from library version 6.2.0.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: e57125b4942a3976aa4ac8f64fb6fda3
GNU assembler version 2.33.1 (x86_64-w64-mingw32) using BFD version (GNU Binutils) 2.33.1
COMPILER_PATH=C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/;C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/;C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/
LIBRARY_PATH=C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/;C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/;C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/lib/../lib/;C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../lib/;C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/lib/;C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../
COLLECT_GCC_OPTIONS='-c' '-v' '-g' '-Wall' '-Werror' '-mwindows' '-D' 'WIN32' '-D' 'USE_OPENGL32' '-march=x86-64' '-mtune=generic' '-O2' '-pipe' '-D' '_LARGEFILE_SOURCE' '-D' '_LARGEFILE64_SOURCE' '-D' '_FILE_OFFSET_BITS=64' '-o' 'e:/Dev/fltk_mingw_test/Debug/fltk_mingw_test.o' '-I' 'C:/ProgramFiles/msys64/mingw64/include/FL' '-shared-libgcc'
Linking...
Using built-in specs.
COLLECT_GCC=C:\ProgramFiles\msys64\mingw64\bin\g++.exe
COLLECT_LTO_WRAPPER=C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-9.2.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++ --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts=yes --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --enable-plugin --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev2, Built by MSYS2 project' --with-bugurl=https://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld
Thread model: posix
gcc version 9.2.0 (Rev2, Built by MSYS2 project)
COMPILER_PATH=C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/;C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/;C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/
LIBRARY_PATH=C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/;C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/;C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/lib/../lib/;C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../lib/;C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/lib/;C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../
COLLECT_GCC_OPTIONS='-v' '-g' '-Wall' '-Werror' '-L/mingw64/lib' '-mwindows' '-pipe' '-o' 'e:/Dev/fltk_mingw_test/Debug/fltk_mingw_test.exe' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/collect2.exe -plugin C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/liblto_plugin-0.dll -plugin-opt=C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/lto-wrapper.exe -plugin-opt=-fresolution=C:\Users\ahead\AppData\Local\Temp\ccyFR6p1.res -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-lpthread -plugin-opt=-pass-through=-lgdi32 -plugin-opt=-pass-through=-lcomdlg32 -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -m i386pep --subsystem windows -Bdynamic -o e:/Dev/fltk_mingw_test/Debug/fltk_mingw_test.exe C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/crtbegin.o -L/mingw64/lib -LC:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0 -LC:/ProgramFiles/msys64/mingw64/bin/../lib/gcc -LC:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/lib/../lib -LC:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../lib -LC:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/lib -LC:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../.. --enable-auto-import --enable-runtime-pseudo-reloc -lfltk -lole32 -luuid -lcomctl32 Debug/fltk_mingw_test.o C:/ProgramFiles/msys64/mingw64/lib/libfltk.a C:/ProgramFiles/msys64/mingw64/lib/libfltk.dll.a C:/ProgramFiles/msys64/mingw64/lib/libfltk_forms.a C:/ProgramFiles/msys64/mingw64/lib/libfltk_forms.dll.a C:/ProgramFiles/msys64/mingw64/lib/libfltk_gl.a C:/ProgramFiles/msys64/mingw64/lib/libfltk_gl.dll.a C:/ProgramFiles/msys64/mingw64/lib/libfltk_images.a C:/ProgramFiles/msys64/mingw64/lib/libfltk_images.dll.a -lstdc++ -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -lpthread -lgdi32 -lcomdlg32 -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/lib/../lib/default-manifest.o C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/crtend.o
C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/ProgramFiles/msys64/mingw64/lib/libfltk.a(Fl.o):(.text$_Z15fl_open_displayv.part.43+0x10): undefined reference to `__imp_OleInitialize'
C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/ProgramFiles/msys64/mingw64/lib/libfltk.a(Fl.o):(.text$__tcf_1+0x10): undefined reference to `__imp_OleUninitialize'
C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/ProgramFiles/msys64/mingw64/lib/libfltk.a(Fl.o):(.text$_ZN4Fl_X4makeEP9Fl_Window+0x2fb): undefined reference to `__imp_RegisterDragDrop'
C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/ProgramFiles/msys64/mingw64/lib/libfltk.a(Fl.o):(.text$_ZL7WndProcP6HWND__jyx+0x41a): undefined reference to `__imp__TrackMouseEvent'
C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/ProgramFiles/msys64/mingw64/lib/libfltk.a(fl_dnd.o):(.text$_ZN12FLDropTarget4DropEP11IDataObjectm7_POINTLPm[_ZN12FLDropTarget4DropEP11IDataObjectm7_POINTLPm]+0x276): undefined reference to `__imp_ReleaseStgMedium'
C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/ProgramFiles/msys64/mingw64/lib/libfltk.a(fl_dnd.o):(.text$_ZN12FLDropTarget4DropEP11IDataObjectm7_POINTLPm[_ZN12FLDropTarget4DropEP11IDataObjectm7_POINTLPm]+0x4e1): undefined reference to `__imp_ReleaseStgMedium'
C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/ProgramFiles/msys64/mingw64/lib/libfltk.a(fl_dnd.o):(.text$_ZN12FLDropTarget4DropEP11IDataObjectm7_POINTLPm[_ZN12FLDropTarget4DropEP11IDataObjectm7_POINTLPm]+0x5db): undefined reference to `__imp_ReleaseStgMedium'
C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/ProgramFiles/msys64/mingw64/lib/libfltk.a(fl_dnd.o):(.text$_ZN12FLDropTarget9DragEnterEP11IDataObjectm7_POINTLPm[_ZN12FLDropTarget9DragEnterEP11IDataObjectm7_POINTLPm]+0x256): undefined reference to `__imp_ReleaseStgMedium'
C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/ProgramFiles/msys64/mingw64/lib/libfltk.a(fl_dnd.o):(.text$_ZN12FLDropTarget9DragEnterEP11IDataObjectm7_POINTLPm[_ZN12FLDropTarget9DragEnterEP11IDataObjectm7_POINTLPm]+0x42e): undefined reference to `__imp_ReleaseStgMedium'
C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/ProgramFiles/msys64/mingw64/lib/libfltk.a(fl_dnd.o):(.text$_ZN12FLDropTarget9DragEnterEP11IDataObjectm7_POINTLPm[_ZN12FLDropTarget9DragEnterEP11IDataObjectm7_POINTLPm]+0x573): more undefined references to `__imp_ReleaseStgMedium' follow
C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/ProgramFiles/msys64/mingw64/lib/libfltk.a(fl_dnd.o):(.text$_ZN2Fl3dndEv+0x5c): undefined reference to `__imp_DoDragDrop'
collect2.exe: error: ld returned 1 exit status
*** Errors occurred during this build ***

e:\Dev\fltk_mingw_test>

***** END OF BUILD OUTPUT *****
« Last Edit: February 28, 2020, 02:34:46 PM by Allan »

Allan

  • Community Member
  • Posts: 26
  • Hero Points: 1
Re: How to Configure a FLTK Project in SEPRO 2019 (v24.0.1.0 64-bit) Windows
« Reply #1 on: February 27, 2020, 04:59:37 AM »
I think I may have discovered the problem.  In a StackOverflow post (https://stackoverflow.com/questions/33131740/compile-fltk-with-g), agold states that the linking parameters must be positioned after the source and header files.  For example: 
Code: [Select]
$ g++ fltk_mingw_test.cpp -lfltk -o fltk_mingw_test.

The above command successfully compiles and builds an executable, but if I move -lfltk so that it comes before the source code and header files:

Code: [Select]
$ g++ -lfltk fltk_mingw_test.cpp -o fltk_mingw_test

I get the following error messages:

Code: [Select]
C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\ProgramFiles\msys64\tmp\cc99H6gV.o:fltk_mingw_test.cpp:(.text+0x38): undefined reference to `Fl_Window::Fl_Window(int, int, char const*)'
C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\ProgramFiles\msys64\tmp\cc99H6gV.o:fltk_mingw_test.cpp:(.text+0x76): undefined reference to `Fl_Box::Fl_Box(int, int, int, int, char const*)'
C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\ProgramFiles\msys64\tmp\cc99H6gV.o:fltk_mingw_test.cpp:(.text+0xb6): undefined reference to `fl_define_FL_SHADOW_LABEL()'
C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\ProgramFiles\msys64\tmp\cc99H6gV.o:fltk_mingw_test.cpp:(.text+0xcc): undefined reference to `Fl_Group::end()'
C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\ProgramFiles\msys64\tmp\cc99H6gV.o:fltk_mingw_test.cpp:(.text+0xe2): undefined reference to `Fl_Window::show(int, char**)'
C:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\ProgramFiles\msys64\tmp\cc99H6gV.o:fltk_mingw_test.cpp:(.text+0xe7): undefined reference to `Fl::run()'
collect2.exe: error: ld returned 1 exit status

Although the functions in the error message are different from those generated by SlickEdit, the error "undefined reference" is the same.  This would seem to suggest that if SlickEdit moved the -l parameter so that it is positioned after the source and header files, then the following code would compile:
Code: [Select]
#include <iostream>
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Box.H>

#include "fltk_mingw_test.h"

using namespace std;

int main (int argc, char *argv[])
{
Fl_Window *window = new Fl_Window(340, 180);
Fl_Box *box = new Fl_Box(20, 40, 300, 100, "Hello World");
box->box(FL_UP_BOX);
box->labelfont(FL_BOLD+FL_ITALIC);
box->labelsize(36);
box->labeltype(FL_SHADOW_LABEL);
window->end();
window->show(argc, argv);
return Fl::run();
}

In the build output, I'm unable to make out what command is being executed. Is it possible that SlickEdit is not positioning the -l parameter so that it comes after the source and header files?

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6866
  • Hero Points: 528
Re: How to Configure a FLTK Project in SEPRO 2019 (v24.0.1.0 64-bit) Windows
« Reply #2 on: February 27, 2020, 10:51:14 PM »
Unix linking can be really picky. Sometimes you even have to specify libraries multiple times if you have a library which references another library.

Allan

  • Community Member
  • Posts: 26
  • Hero Points: 1
Re: How to Configure a FLTK Project in SEPRO 2019 (v24.0.1.0 64-bit) Windows
« Reply #3 on: February 28, 2020, 12:31:53 AM »
SOLVED!! :)

Here's what I did:

1.  Backed out (removed) the changes to the Project Properties --> Directories tab and Project Properties --> Compile/Link tab.
2.  Created a Makefile based on the sample from the fltk.org site.
3.  In the Project Properties --> Build tab, under Build System I selected "Build with user-maintained makefile or custom build command".
4.  In the Build --> GNU C Options --> Link tab, I set other options to -lftlk.

Code: [Select]
#
# DATE: 2020 FEB 27
# FILENAME: Makefile
# DESCRIPTION:  This is a Makefile for the MSYS2 version of FLTK
# 1.3.5.  It will compile and build the Hello World program
# found at https://www.fltk.org/doc-1.3/basics.html#basics_standard_compiler
#
CXX      = $(shell fltk-config --cxx)
DEBUG    = -g
CXXFLAGS = $(shell fltk-config --use-gl --use-images --cxxflags ) -I.
LDFLAGS  = $(shell fltk-config --use-gl --use-images --ldflags )
LDSTATIC = $(shell fltk-config --use-gl --use-images --ldstaticflags )
LINK     = $(CXX)

TARGET = C:\<your path>\fltk_mingw_test.exe #File extension must be exe
OBJS =   fltk_mingw_test.o
SRCS =   fltk_mingw_test.cpp

.SUFFIXES: .o .cpp
%.o: %.cpp
$(CXX) $(CXXFLAGS) $(DEBUG) -c $<

all: $(TARGET)
$(LINK) -o $(TARGET) $(OBJS) $(LDSTATIC)

$(TARGET): $(OBJS)
fltk_mingw_test.o: fltk_mingw_test.cpp fltk_mingw_test.h

clean: $(TARGET) $(OBJS)
rm -f *.o 2> /dev/null
rm -f $(TARGET) 2> /dev/null


HTH someone else

Allan

  • Community Member
  • Posts: 26
  • Hero Points: 1
Re: How to Configure a FLTK Project in SEPRO 2019 (v24.0.1.0 64-bit) Windows
« Reply #4 on: February 28, 2020, 12:40:46 AM »
Clark, thanks for the input. It's nice to know that it's not just me.

I'm working my way through Stroupstrup's Programming, Principles, and Practices Using C++ and it's been quite the adventure trying to get the FLTK library to work on a MS Windows machine.  I now have it working using both Visual Studio 2019 and SlickEdit.  It's much faster using SlickEdit  ;).