0
votes

I have a c++ project that references the .h and .cpp files from the (ACE_TAO) library. (http://www.theaceorb.com/)

I have included the library paths to the project GCC C++ compiler and GCC C++ Linker.

However, when I try to build my project, I keep getting an error.

undefined reference to ACE_Message_Block::~ACE_Message_Block() 
    | line 627 external location /home/user/Documents/ACE_wrappers/ace/CDR_Stream.inl

undefined reference to CORBA::ORB~ORB();
    | line 45 external location /home/user/Documents/ACE_wrappers/Tao/tao/ORB.inl

Here's my own project header file

#ifndef MESSENGERSERVER_H_
#define MESSENGERSERVER_H_
#include <tao/ORB.h>   // this is causing the error

class MessengerServer {
public:
    MessengerServer();
    virtual ~MessengerServer();
private:
    CORBA::ORB_var orb; // this is causing the error

1) I have included the right header file and eclipse is able to to resolve the header file, so this must mean that my library paths is correct right?

2) If my library paths are correct, why is eclipse unable to link to the .cpp files for the implementation of the 2 methods? my .h file and .cpp files are in the same folder directory.

3) I thought that it could be because I do not have the .o files in the library paths, so i ran 'make' and generated the .o files in the same directory, but I still get the same error.

Am I missing/misunderstanding something? Thanks in advance.

update: Here's the command Eclipse c++ used to build my project

g++ -I/home/user/Documents/ACE_wrappers/TAO/
-I/home/user/Documents/ACE_wrappers/ace/
-I/home/user/Documents/ACE_wrappers/
-O0- g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"myMain.d" -MT"myMain.d" -o"myMain.o" "../myMain.cpp"
Finished Building:../MyMain.cpp

g++ -I/home/user/Documents/ACE_wrappers/TAO/
-I/home/user/Documents/ACE_wrappers/ace/
-I/home/user/Documents/ACE_wrappers/
-O0- g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"MyServer.d" -MT"MyServer.d" -o"MyServer.o" "../MyServer.cpp"
Finished Building:../MyServer.cpp

g++ -L/home/user/Documents/ACE_wrappers/TAO/ 
-L/home/user/Documents/ACE_wrappers/ace/
-L/home/user/Documents/ACE_wrappers/
-o "TAOServer" ./myMain.o ./MyServer.o
./MyMain.o: In function 'ACE_InputCDR:~ACE_InputCDR()':
/home/user/Documents/ACE_wrappers/ace/CDR_Stream.inl:627: undefined reference to ACE_Message_Block::~ACE_Message_Block() 
./MyServer.o: In function 'CORBA::ORB:decr_refcount()':
/home/user/Documents/ACE_wrappers/Tao/tao/ORB.inl:45: undefined reference to CORBA::ORB~ORB();
1

1 Answers

0
votes

The linking is failing. No, your "include" path determines whether you can find a header file. The "library" path is used for linking against the object files or the library files. The linking is not working.

The missing functions are the destructors for the classes ACE_Message_Block and ORB. Find the source files for them, compile them, and make sure the compiled object files are on the library path for your project.