Thank you very much Antonio! You were right, the issue was exactly as you said. That solved my issue, and i can now compile this example using a C++ compiler.
El vie., 21 dic. 2018 a las 10:47, Antonio Scuri (<antonio.sc...@gmail.com>) escribió: > Probably is because the function declaration being done in the file. I > guess since you are using g++ to build the sample it could being compiled > as C++, then the function declaration is incorrect because it is missing > the extern C. So the linker error. > > I think something like this can fiz the problem: > > #ifdef __cplusplus > extern "C" char *iupKeyCodeToName(int code); > #endif > > Best, > Scuri > > > Em sex, 21 de dez de 2018 às 01:09, Daniel G. <danigaritaro...@gmail.com> > escreveu: > >> Hello I'm trying to make a windows executable of this example: >> https://www.tecgraf.puc-rio.br/iup/examples/C/sample.c >> On Linux with help of this tool: https://github.com/jprjr/iup-build >> On Ubuntu 16.04, but i get this linking error when trying to >> cross-compile: >> daniel@daniel-desktop:~/Desktop/$ make >> i686-w64-mingw32-g++ -static >> -I/home/daniel/iup-build/deps/iup-3.22/include >> -I/home/daniel/iup-build/deps/cd-5.11.1/include >> -I/home/daniel/iup-build/deps/im-3.12/include >> -I/home/daniel/iup-build/deps/zlib-1.2.8/include >> -I/home/daniel/iup-build/deps/freetype-2.6.3/include -o sample.exe sample.c >> -L/home/daniel/iup-build/deps/iup-3.22/lib/mingw4 >> -L/home/daniel/iup-build/deps/cd-5.11.1/lib/mingw4 >> -L/home/daniel/iup-build/deps/im-3.12/lib/mingw4 >> -L/home/daniel/iup-build/deps/zlib-1.2.8/lib/mingw4 >> -L/home/daniel/iup-build/deps/freetype-2.6.3/lib/mingw4 -lm -lcdim -lim >> -lim_process -lcd -liupcd -liupim -liupimglib -liupcontrols -liup -liupgl >> -lz -lim -lcd -lfreetype6 -lgdi32 -lcomdlg32 -lcomctl32 -luuid -loleaut32 >> -lole32 -lwinspool >> /tmp/cccFDodU.o:sample.c:(.text+0x1da): undefined reference to >> `iupKeyCodeToName(int)' >> /tmp/cccFDodU.o:sample.c:(.text+0x215): undefined reference to >> `iupKeyCodeToName(int)' >> /tmp/cccFDodU.o:sample.c:(.text+0x55e): undefined reference to >> `iupKeyCodeToName(int)' >> collect2: error: ld returned 1 exit status >> makefile:18: recipe for target 'sample.exe' failed >> make: *** [sample.exe] Error 1 >> >> libiup.a seem to have iupKeyCodeToName: >> daniel@daniel-desktop:~/iup-build/output/iup-3.22-i686-w64-mingw32/i686-w64-mingw32/lib$ >> nm -C -A *.a | grep iupKeyCodeToName >> libiup.a:iup_key.o:00000340 T iupKeyCodeToName >> libiup.dll.a:d000887.o:00000000 I _imp__iupKeyCodeToName >> libiup.dll.a:d000887.o:00000000 T iupKeyCodeToName >> >> So I have no idea what is causing this, I've also tried doing the same >> but natively on Windows 7 also using mingw, but fail with the exact same >> error. I haven't tried other compilers yet. >> >> I can however compile this example for Linux on Ubuntu 16.04 using gcc >> without any issues. >> >> Any hints on how to solve this would me much appreciated. >> _______________________________________________ >> Iup-users mailing list >> Iup-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/iup-users >> > _______________________________________________ > Iup-users mailing list > Iup-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/iup-users >
_______________________________________________ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users