I run g ++ under ubuntu11.10

zhas@zhas-Aspire-5740:~/ma-source/gts/fann/src$ g++ gis_train.cpp -l "doublefann" -I "include/" /usr/bin/ld: cannot find -ldoublefann collect2: выполнение ld завершилось с кодом возврата 1 

proof that the file is in place (doublefann.a):

 zhas@zhas-Aspire-5740:~/ma-source/gts/fann/src$ dir CMakeLists.txt doublefann.o fann_error.c fann_train_data.c gis_train.cpp doublefann.a fann.c fann_io.c fixedfann.c include doublefann.c fann_cascade.c fann_train.c floatfann.c 

then I tried to write the full path to

 zhas@zhas-Aspire-5740:~/ma-source/gts/fann/src$ g++ gis_train.cpp -lhome/zhas/ma-source/gts/fann/src/doublefann -I "include/" /usr/bin/ld: cannot find -lhome/zhas/ma-source/gts/fann/src/doublefann collect2: выполнение ld завершилось с кодом возврата 1 

then I shoved it into / usr / lib /, and even not see it (((

help plz

ps tried the same g ++ on Windows, everything works, but I need it under ubuntu

  • Remove space / quotes in option 1? Put quotes in option 2? Not enough rights to read? Can you try to make a separate object from gis_train, and then link it together? Or you should write a makefile, since the file is not one. The Hz is not a master and Linux unfortunately is not at hand. - Dith

1 answer 1

When you write the -l "smthng" option on the command line (or, as usual, write -lsmthng), you tell the compiler to find and link the library libsmthng.so or libsmthng.a. The compiler searches for libraries in the system default directories (usually / usr / lib) and in the directories specified with the -L option. So, in your case, you need to rename doublefann.a to libdoublefann.a and compile it like this:

 g++ gis_train.cpp -l doublefann -I "include/" -L.