At the command prompt, the following creates an executable file:
g++ -o a.out main.cpp class1.cc class2.cc /usr/lib/libgsl.a /usr/lib/libgslcblas.a
However, I'm not sure how to get cmake to work correctly. When I add a line like
include_directories(/usr/lib/) link_libraries(usr/lib/libgsl.a usr/libgslcblas.a)
the configuration seems to work, but the build fails:
CMakeFiles/kmv.dir/main.o: In function `main': main.cpp:27: undefined reference to `gsl_matrix_alloc' main.cpp:35: undefined reference to `gsl_matrix_fscanf' collect2: ld returned 1 exit status make[2]: *** [kmv] Error 1 make[1]: *** [CMakeFiles/kmv.dir/all] Error 2 make: *** [all] Error 2 *** Failed ***
This seems to be a syntax issue. Any hint is welcome. Thanks.
source share