|
AIX5.3系统上,编译一段很简单的代码,但是编译一直提示:
xlC_r -I/home/fjuvc/ACE/ACE_wrappers -g -q64 -c -o ACE_TEST.o ACE_TEST.cpp
xlC_r -I/home/fjuvc/ACE/ACE_wrappers -g -q64 -o ACE_TEST ACE_TEST.o -L/home/fjuvc/ACE/ACE_wrappers/lib -L/home/fjuvc/ACE/ACE_wrappers/ace -lACE
ld:0711-317 错误:未定义的符号:.ACE_Get_Opt::ACE_Get_Opt(int,char**,const char*,int,int,int,int)
ld:0711-317 错误:未定义的符号:.ACE_Log_Msg::last_error_adapter()
ld:0711-317 错误:未定义的符号:.ACE_Log_Msg::instance()
ld:0711-317 错误:未定义的符号:.ACE_Log_Msg::conditional_set(const char*,int,int,int)
ld:0711-317 错误:未定义的符号:.ACE_Log_Msg::log(ACE_Log_Priority,const char*,...)
ld:0711-317 错误:未定义的符号:.ACE_Get_Opt::operator()()
ld:0711-317 错误:未定义的符号:ACE_Addr::sap_any
ld:0711-317 错误:未定义的符号:.ACE_SOCK_Dgram_Bcast::ACE_SOCK_Dgram_Bcast(const ACE_Addr&,int,int,int,const char*)
ld:0711-317 错误:未定义的符号:.ACE_SOCK_Dgram_Bcast::send(const void*,unsigned long,unsigned short,int) const
ld:0711-317 错误:未定义的符号:.ACE_SOCK_Dgram_Bcast::~ACE_SOCK_Dgram_Bcast()
ld:0711-317 错误:未定义的符号:.ACE_Get_Opt::~ACE_Get_Opt()
ld:0711-345 使用 -bloadmap 或 -bnoquiet 选项获取详细信息。
gmake: *** [ACE_TEST] Error 8
我的Makefile文件也很简单:
CXX = xlC_r
CXXFLAGS = -I$(ACE_ROOT) -g -q64
OBJS = ACE_TEST.o
LIBS = -L$(ACE_ROOT)/lib -lACE
TARGET = ACE_TEST
$(TARGET): $(OBJS)
$(CXX) $(CXXFLAGS) -o $(TARGET) $(OBJS) $(LIBS)
all: $(TARGET)
clean:
rm -f $(OBJS) $(TARGET)
环境变量也已经配置好:
export ACE_ROOT=/home/fjuvc/ACE/ACE_wrappers
export LD_LIBRARY_PATH=$ACE_ROOT/lib:$ACE_ROOT/ace
export PATH=$ACE_ROOT/bin:$ACE_ROOT/lib:$ACE_ROOT/ace:/usr/local/include:/usr/include:/usr/vacpp/include:/usr/local/ssl/include:$PAT
H
AIX编译生成的是libACE.a
最后贴上代码,请帮帮忙:- #include <stdio.h>
- #include <stdlib.h>
- #include <ace/OS.h>
- #include <ace/Get_Opt.h>
- #include <ace/SOCK_Dgram_Bcast.h>
- #include <ace/Addr.h>
- #include <ace/Log_Msg.h>
- int ACE_TMAIN(int argc, ACE_TCHAR* argv[])
- {
- //Specify option string so that switches b, d, f and h all expect
- //arguments. Switches a, c, e and g expect no arguments.
- ACE_Get_Opt get_opt (argc, argv, "ab:cd:ef:gh:");
- int c;
- //Process the scanned options with the help of the overloaded ()
- //operator.
- while ((c = get_opt ()) != EOF)
- switch (c)
- {
- case 'a':
- ACE_DEBUG ((LM_DEBUG, "got a\n"));
- break;
- case 'b':
- ACE_DEBUG ((LM_DEBUG, "got b with arg %s\n", get_opt.optarg));
- break;
- case 'c':
- ACE_DEBUG ((LM_DEBUG, "got c\n"));
- break;
- case 'd':
- ACE_DEBUG ((LM_DEBUG, "got d with arg %s\n", get_opt.optarg));
- break;
- case 'e':
- ACE_DEBUG ((LM_DEBUG, "got e\n"));
- break;
- case 'f':
- ACE_DEBUG ((LM_DEBUG, "got f with arg %s\n", get_opt.optarg));
- break;
- case 'g':
- ACE_DEBUG ((LM_DEBUG, "got g\n"));
- break;
- case 'h':
- ACE_DEBUG ((LM_DEBUG, "got h with arg %s\n", get_opt.optarg));
- break;
- default:
- ACE_DEBUG ((LM_DEBUG, "got %c, which is unrecognized!\n",c));
- break;
- }
- //optind indicates how much of argv has been scanned so far, while
- //get_opt hasn"t returned EOF. In this case it indicates the index in
- //argv from where the option switches have been fully recognized and the
- //remaining elements must be scanned by the called himself.
- for (int i = get_opt.optind; i < argc; i++)
- ACE_DEBUG ((LM_DEBUG, "optind = %d, argv[optind] = %s\n", i, argv[i]));
- ACE_SOCK_Dgram_Bcast b_sap(ACE_Addr::sap_any);
- char *msg;
- unsigned short b_port;
- msg = argc > 1 ? argv[1] : "hello world\n";
- b_port = argc > 2 ? atoi (argv[2]) : 3702;
- if (b_sap.send (msg, strlen (msg), b_port) == -1)
- perror ("can’t send broadcast"), exit (1);
- getchar();
- return 0;
- }
复制代码 |
|