a.toraby
a.toraby

Reputation: 3391

Eclipse doesn't find my static libraries

I want to use SRILM package in my project. I've compiled SRILM successfully and now there are static libraries in ~/srilm/lib/i686-ubuntu I created a c++ project in eclipse and added libdstruct.a to libraries and set its path as directory for searching libraries. But eclipse can't find my library! Following code is the output when I click on build project button in eclipse. As you see g++ says cannot find -llibdstruct

**** Build of configuration Debug for project test ****

make all 
Building file: ../src/test.c
Invoking: GCC C Compiler
gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/test.d" -MT"src/test.d" -o"src/test.o" "../src/test.c"
Finished building: ../src/test.c

Building target: test
Invoking: GCC C Linker
gcc -L/home/atp/srilm/lib/i686-ubuntu -o"test"  ./src/test.o   -llibdstruct
/usr/bin/ld: cannot find -llibdstruct
collect2: ld returned 1 exit status
make: *** [test] Error 1

Upvotes: 1

Views: 2897

Answers (1)

Employed Russian
Employed Russian

Reputation: 213516

/usr/bin/ld: cannot find -llibdstruct

When you pass -llibdstruct flag to the linker, you are asking it to look for a file called liblibdstruct.a . There is no such file, so the linker rightfully complains.

The file you actually want is called libdstruct.a, and the correct flag to pass is -ldstruct.

Upvotes: 2

Related Questions