#include "ace/OS.h"
#include "ace/Log_Msg.h"
?
int main (int argc, char *argv[])
{
? ACE_DEBUG((LM_DEBUG,"Hello, ACE!\n"));
? ACE_OS::exit(1);
? return 0;
}
使用VS6編譯:
1、提示有“Cannot open include file: 'ace/SOCK_Acceptor.h':No such file or directory”
工程-設(shè)置-C/C++: Preprocessor,附加包含路徑:H:\ACE\ACE-5.5\ACE_wrappers
2、提示有“ You must link against multi-threaded libraries when using ACE (check your project settings)”
工程-設(shè)置-C/C++: Code Generation - Use run-time library : Debug Multithreaded Dll
3、提示有“error C2065: 'ACE_ERROR' : undeclared identifier”
??????? error C2065: 'ACE_DEBUG' : undeclared identifier
#include "ace/Log_Msg.h"
4、提示error C4716: 'ace_main_i' : must return a value
在main中加入 return 0;
5、提示“error LNK2001: unresolved external symbol "__declspec(dllimport) int __cdecl”
工程-設(shè)置-Link-Input: 對(duì)象/庫(kù)模塊:添加ACEd.lib????????????????????????
附加庫(kù)路徑:H:\ACE\ACE-5.5\ACE_wrappers\lib?
使用linux編譯:
makefile 文件如下:
ACE_LIB = $(ACE_ROOT)/ace
LFLAGS = -L$(ACE_LIB) -lACE
CFLAGS = -Wall -O2 -D NDEBUG
IFLAGS = -I $(ACE_ROOT)
OBJS = test_ace.o
??????
all: test_ace.exe
?????????
test_ace.exe: $(OBJS)
?g++ -o $@ $(OBJS) $(LFLAGS)
?@echo done!
????????????
test_ace.o: test_ace.cpp
?g++ -c $(CFLAGS) $(IFLAGS) $<
???
clean:
?@rm *.o *.exe
?@echo done!