为什么我在尝试编译我的第一个 CORBA 服务器(使用 ACE/TAO ORB 实现)时遇到链接器错误
Why do I get linker errors trying to compile my first CORBA server (using ACE/TAO ORB implementation)?
尝试实现我的第一个 CORBA 服务器(使用 ACE/TAO ORB 实现(,我使用以下 makefile:
#compiler
CC=g++
#compiler options
CPPFLAGS=-Wall -I. -I/usr/include/ -I/usr/include/orbsvcs/
LFLAGS=-L/usr/lib64/ -lACE -lTAO -lTAO_PortableServer -lTAO_DynamicAny -lTAO_CosNotification -lTAO_CosNaming
#source files
SOURCES=$(wildcard *.cpp)
#object files
OBJECTS=$(SOURCES:.cpp=.o)
#executable filename
EXECUTABLE=main
#Special symbols used:
#$^ - is all the dependencies (in this case =$(OBJECTS) )
#$@ - is the result name (in this case =$(EXECUTABLE) )
all: $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
#$(LINK.o) $^ -o $@
$(CC) $(LFLAGS) $^ -o $@
%.o: %.c
$(CC) $(CPPFLAGS) -c $<
clean:
- rm -rf $(EXECUTABLE) $(OBJECTS)
我在编译时收到以下错误:
g++ -Wall -I. -I/usr/include/ -I/usr/include/orbsvcs/ -c -o cryptC.o cryptC.cpp
g++ -Wall -I. -I/usr/include/ -I/usr/include/orbsvcs/ -c -o cryptS.o cryptS.cpp
g++ -Wall -I. -I/usr/include/ -I/usr/include/orbsvcs/ -c -o main.o main.cpp
In file included from main.cpp:5:
CryptographicImpl.h: In member function ‘virtual char* CryptographicImpl::decrypt(const CaesarAlgorithm::charsequence&, CORBA::ULong, CORBA::ULong)’:
CryptographicImpl.h:49: warning: comparison between signed and unsigned integer expressions
#g++ cryptC.o cryptS.o main.o -o main
g++ -L/usr/lib64/ -lTAO_PortableServer -lTAO_DynamicAny -lACE -lTAO -lTAO_CosNotification -lTAO_CosNaming cryptC.o cryptS.o main.o -o main
cryptC.o: In function `TAO::Objref_Traits<CaesarAlgorithm>::marshal(CaesarAlgorithm*, TAO_OutputCDR&)':
cryptC.cpp:(.text+0x7f): undefined reference to `CORBA::Object::marshal(CORBA::Object*, TAO_OutputCDR&)'
整个编译日志:http://pastebin.com/0KpLXixw
我在 CentOS 6.6 上使用这个存储库中的 ACE (6.2.8( 和 TAO(2.2.8(
库的顺序很重要,从右到左,您应该确保首先指定基本库,而不是使用基本库的库,例如 -lTAO_PortableServer -lTAO_AnyTypeCode -lTAO -lACE -ldl -lrt
.有关更多信息,另请参阅为什么库的链接顺序有时会导致 GCC 中的错误?。
我建议您编译 TAO 附带的单元测试之一并从那里复制,或者使用 MPC 生成生成文件。
还要检查 TAOX11,新的 IDL 到 C++11 语言映射更易于使用,我们提供免费的评估许可证,您可以将其用于课堂使用。
相关文章:
- 如果没有malloc,链表实现将失败
- 如何在c++中实现处理器调度模拟器
- 如何在c++中使用引用实现类似python的行为
- 实现无开销push_back的最佳方法是什么
- 使用简单类型列表实现的指数编译时间.为什么
- 如何在BST的这个简单递归实现中消除警告
- 实现一个在集合上迭代的模板函数
- 我应该实现右值推送功能吗?我应该使用std::move吗
- 如何正确实现和访问运算符的各种自定义枚举器
- C++Union/Struct位域的实现和可移植性
- 这个极客对极客的trie实现是否存在内存泄漏问题
- 在c++中实现LinkedList时,应出现未处理的错误
- 为左值和右值的包装器实现C++范围
- 使用模板进行堆栈实现; "name followed by :: must be a class or namespace"
- 使用GSoap实现ONVIF
- 在用于格式4的arm模拟器中实现功能时的一个问题
- 用于AVX的ln(x)的实现,m256
- 用常见虚拟函数实现的任意组合来实现派生类的正确方法是什么
- 为什么我在尝试编译我的第一个 CORBA 服务器(使用 ACE/TAO ORB 实现)时遇到链接器错误
- OpenCV ORB GPU的实现速度比CPU慢