簡體   English   中英

為什么在嘗試編譯我的第一個 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 上使用這個 repo中的 ACE (6.2.8) 和 TAO(2.2.8)

庫的順序很重要,從右到左你應該確保首先指定基礎庫,而不是使用基礎的庫,例如-lTAO_PortableServer -lTAO_AnyTypeCode -lTAO -lACE -ldl -lrt 有關詳細信息,另請參閱為什么鏈接庫的順序有時會導致 GCC 出錯? .

我建議您編譯 TAO 提供的單元測試之一並從那里復制,或者使用 MPC 生成 makefile。

還要檢查TAOX11 ,新的 IDL 到 C++11 語言映射更易於使用,我們提供免費的評估許可證,您可以將其用於課堂使用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM