se scrivo un file helloworld.cpp e includo vari files .h scritti da me, riesco a compilare senza problemi usando
Codice: Seleziona tutto
x86_64-w64-mingw32-g++ -static-libstdc++ -static-libgcc helloworld.cpp -o helloworld
e includendo i file
Codice: Seleziona tutto
#include "json.h"
#include "json-builder.h"
Codice: Seleziona tutto
$ make
x86_64-w64-mingw32-g++ -municode -static-libstdc++ -static-libgcc helloworld.cpp -o helloworld
/usr/bin/x86_64-w64-mingw32-ld: /tmp/cc2nVEDA.o:helloworld.cpp:(.text+0x2b5e): undefined reference to `json_object_new'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/cc2nVEDA.o:helloworld.cpp:(.text+0x2b74): undefined reference to `json_string_new'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/cc2nVEDA.o:helloworld.cpp:(.text+0x2b8a): undefined reference to `json_string_new'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/cc2nVEDA.o:helloworld.cpp:(.text+0x2ba5): undefined reference to `json_string_new'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/cc2nVEDA.o:helloworld.cpp:(.text+0x2bbb): undefined reference to `json_string_new'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/cc2nVEDA.o:helloworld.cpp:(.text+0x2bcc): undefined reference to `json_array_new'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/cc2nVEDA.o:helloworld.cpp:(.text+0x2be2): undefined reference to `json_string_new'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/cc2nVEDA.o:helloworld.cpp:(.text+0x2bff): undefined reference to `json_array_push'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/cc2nVEDA.o:helloworld.cpp:(.text+0x2c1f): undefined reference to `json_object_push'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/cc2nVEDA.o:helloworld.cpp:(.text+0x2c3f): undefined reference to `json_object_push'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/cc2nVEDA.o:helloworld.cpp:(.text+0x2c5f): undefined reference to `json_object_push'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/cc2nVEDA.o:helloworld.cpp:(.text+0x2c7f): undefined reference to `json_object_push'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/cc2nVEDA.o:helloworld.cpp:(.text+0x2c9f): undefined reference to `json_object_push'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/cc2nVEDA.o:helloworld.cpp:(.text+0x2cae): undefined reference to `json_measure'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/cc2nVEDA.o:helloworld.cpp:(.text+0x2cd3): undefined reference to `json_serialize'
collect2: error: ld returned 1 exit status
make: *** [makefile:18: helloworld] Error 1
Codice: Seleziona tutto
x86_64-w64-mingw32-g++ -static-libstdc++ -static-libgcc helloworld.cpp json.c json-builder.c -o helloworld
quello che mi chiedo è: questi sono errori che mi ricordano il mancato link di una libreria già compilata, ma se io includo i file della libreria come faccio con qualunque file *.h, questi non dovrebbero essere compilati senza doverli specificare sulla linea del comando per la compilazione ?