3

I am writing a C++ program in Linux with NetBeans. I am having difficulty setting it up to use external sources/shared objects. I have the .so files from the compiled external package and the source files that go with it.

So far I have:

  • specified for the project to include all the source and header file directories (under Project properties->Build->C++ Compiler)
  • specified the .so files that correspond to the external source code (under Project properties->Build-Linker)

When I try to declare an object defined in the external sources NetBeans does not give me any syntax errors and even auto-completes the object name for me. However, when I build the program I get an error saying "undefined reference to" that object.

Am I doing something horribly wrong?

EDIT: In response to quamrana's question, this is one of the output lines in the console when it attempts to build.

g++  -o dist/Debug/GNU-Linux-x86/JAUSTester build/Debug/GNU-Linux-x86/MainScreen.o build/Debug/GNU-Linux-x86/main.o build/Debug/GNU-Linux-x86/moc_MainScreen.o    -L/usr/lib -Wl,-rpath /usr/local/lib/active /usr/local/lib/active/libcxutils.so -Wl,-rpath /usr/local/lib/active/libjauscore.so -Wl,-rpath /usr/local/lib/active/libjausextras.so -Wl,-rpath /usr/local/lib/active/libjausmobility.so -Wl,-rpath /usr/local/lib/active/libtinyxml.so -lQtGui -lQtCore -lpthread

The .so files I want to include are the ones specified there in /usr/local/lib/active/.

KLing
  • 195
  • 1
  • 10
  • Is it possible with NetBeans to check to see what command line it will use when linking? – quamrana May 29 '11 at 16:31
  • Thanks for the reply. I added the line as an edit. Is that what you were looking for? – KLing May 29 '11 at 18:28
  • The auto-complete works because the project correctly references the header files. I'm not sure about the linker stage as I'm not familiar with the `-Wl,-rpath` option. I was expecting, first `-L/usr/local/lib/active` to tell the linker about the folder, then, `-lcxutils` etc (ie without the lib and without the .so) for each of the shared libraries. – quamrana Jun 11 '11 at 17:33

0 Answers0