I'm building a very small C/C++ project using eclipse and i'm getting the following during build:
make all
Building file: ../Metric.cpp
Invoking: GCC C++ Compiler
g++ -I/usr/include/glib-2.0 -I/usr/include/libgtop-2.0 -I/usr/lib/glib-2.0/include -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"Metric.d" -MT"Metric.d" -o"Metric.o" "../Metric.cpp"
Finished building: ../Metric.cpp
Building target: linuxMonitor
Invoking: GCC C++ Linker
g++ -L/usr/lib -o"linuxMonitor" ./Metric.o
./Metric.o: In function main':
glibtop_init'
/home/mike/workspace_c/linuxMonitor/Debug/../Metric.cpp:27: undefined reference to
collect2: ld returned 1 exit status
make: * [linuxMonitor] Error 1
What I can't figure out is why the linking is failing, or which linking flags to use to make this darn thing work! -L/usr/lib
should be point the linker to the directory where the library is, but it still fails. When I do -l/usr/lib/myLibrary.a
it still fails saying that it can't find -l/usr/lib/myLibrary.a
Any tips or advice on using the right commands for the linker would be appreciated! I'm stuck!
-Mike