请问编译出错的原因.....
我在MINGW+MSYS已经编译好了ACE,在系统环境也配置好变量,在Eclipse也配置好lib的路径.就这一段代码:
#include <stdio.h>
#include <ace/OS.h>
int main (int argc , char* argv[]) {
printf ("Hello,World.");
return 0;
}
编译的时候总出现以下错误:
C:/ACE_wrappers/ace/Time_Value.h undefined reference to`_imp__ZN14ACE_Time_Value4zeroE`
C:/ACE_wrappers/ace/Time_Value.h undefined reference to `_Imp__ZN14ACE_Time_Value8max_timeE`
undefined reference to `_imp__ZN13ACE_Main_Base3runEIPPC`
undefined reference to `_imp__ZN13ACE_Main_BaseC2Ev`
undefined reference to `_imp__ZN13ACE_Main_BaseD2Ev`
只要插入ACE的头文件就是undefined reference
下面是编译详细信息:
**** Build of configuration Debug for project ace_test ****
**** Internal Builder is used for build ****
g++ -IC:\ACE_wrappers -O0 -g3 -Wall -c -fmessage-length=0 -osrc\test.o ..\src\test.cpp
g++ -LC:\ACE_wrappers -LC:\ACE_wrappers\ace -LC:\ACE_wrappers\bin -LC:\ACE_wrappers\lib -oace_test.exe src\test.o
src\test.o: In function `main':
D:/C_WorkSapce/ace_test/Debug/../src/test.cpp:4: undefined reference to `_imp___ZN13ACE_Main_Base3runEiPPc'
src\test.o: In function `Z41__static_initialization_and_destruction_0ii':
C:/ACE_wrappers/ace/Time_Value.h:353: undefined reference to `_imp___ZN14ACE_Time_Value4zeroE'
C:/ACE_wrappers/ace/Time_Value.h:354: undefined reference to `_imp___ZN14ACE_Time_Value8max_timeE'
src\test.o: In function `main':
D:/C_WorkSapce/ace_test/Debug/../src/test.cpp:4: undefined reference to `_imp___ZN13ACE_Main_BaseD2Ev'
D:/C_WorkSapce/ace_test/Debug/../src/test.cpp:4: undefined reference to `_imp___ZN13ACE_Main_BaseC2Ev'
D:/C_WorkSapce/ace_test/Debug/../src/test.cpp:4: undefined reference to `_imp___ZN13ACE_Main_BaseD2Ev'
collect2: ld returned 1 exit status
Build error occurred, build is stopped
Time consumed: 1203ms.
请问是什么原因呢? 已经郁闷了一晚.............
对了,ACE_ROOT = C:/ACE_wrappers
acelib.dll 在 C:/ACE_wrappers/lib,已经分别在系统PATH变量中加入此路径,也在Eclipse连接选项的library中加入此路径
thanks 加上 -lACE 试试 谢楼上的
还有另外一个问题.....
编译的时候出错:
C:/ACE-wrappers/ace/ACE.H `ACE_UINT16` does not name a type
查过他的头文件,已经定义了unsigned short int 了,却还是报这样的错 libACE有连接了,但是只要一插入ACE的头文件,就报1000多个错误,是编译器问题吗?
这个是第1个报的错误.......
C:/ACE_wrappers/ace/OS_NS_signal.h:127: error: `ACE_SignalHandler' does not name a type
我也遇到同样的问题。
这是Timer_Value.h中的代码,其中说对于MingW环境来说,这个问题是存在的。可是如何解决???#if defined (__MINGW32__)
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// The MingW linker has problems with the exported statics
// zero and max_time with these two statics the linker will be able to
// resolve the static exported symbols.
static const ACE_Time_Value& __zero_time = ACE_Time_Value::zero;
static const ACE_Time_Value& __max_time = ACE_Time_Value::max_time;
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* __MINGW32__ */
#include /**/ "ace/post.h"
#endif /* ACE_TIME_VALUE_H */
回复 #5 dhyuan 的帖子
To add these options when you do the link will solve this problem.-lACE -lws2_32 -lmswsock -lwsock32 -lnetapi32 哎~问题还是存在.......而且还很奇怪......
Severity and Description Path Resource Location Creation Time Id
C:/ACE_wrappers/ace/dirent.h expected `;' before '*' token test line 73 1202018274031 90485
C:/ACE_wrappers/ace/dirent.h expected `;' before '*' token test line 112 1202018274031 90487
C:/ACE_wrappers/ace/dirent.h ISO C++ forbids declaration of `ACE_DIR' with no type test line 112 1202018274031 90486
C:/ACE_wrappers/ace/dirent.h ISO C++ forbids declaration of `ACE_DIRENT' with no type test line 73 1202018274031 90484
C:/ACE_wrappers/ace/os_include/os_dirent.h `DIR' does not name a type test line 89 1202018274031 90488
C:/ACE_wrappers/ace/OS_NS_dirent.h `ACE_DIR' was not declared in this scope test line 67 1202018274031 90495
C:/ACE_wrappers/ace/OS_NS_dirent.h `ACE_DIR' was not declared in this scope test line 84 1202018274031 90500
C:/ACE_wrappers/ace/OS_NS_dirent.h `ACE_DIR' was not declared in this scope test line 90 1202018274031 90504
C:/ACE_wrappers/ace/OS_NS_dirent.h `ACE_DIR' was not declared in this scope test line 93 1202018274031 90507
C:/ACE_wrappers/ace/OS_NS_dirent.h `ACE_DIR' was not declared in this scope test line 98 1202018274046 90514
C:/ACE_wrappers/ace/OS_NS_dirent.h `ACE_DIR' was not declared in this scope test line 110 1202018274046 90518
C:/ACE_wrappers/ace/OS_NS_dirent.h `ACE_DIR' was not declared in this scope test line 114 1202018274046 90523
C:/ACE_wrappers/ace/OS_NS_dirent.h `ace_rewinddir_helper' declared as an `inline' variable test line 67 1202018274031 90494
C:/ACE_wrappers/ace/OS_NS_dirent.h `dir' was not declared in this scope test line 67 1202018274031 90496
C:/ACE_wrappers/ace/OS_NS_dirent.h `dirp' was not declared in this scope test line 93 1202018274031 90508
C:/ACE_wrappers/ace/OS_NS_dirent.h expected `,' or `;' before '{' token test line 68 1202018274031 90497
C:/ACE_wrappers/ace/OS_NS_dirent.h expected `,' or `...' before '*' token test line 48 1202018274031 90489
C:/ACE_wrappers/ace/OS_NS_dirent.h expected `,' or `...' before '*' token test line 54 1202018274031 90491
C:/ACE_wrappers/ace/OS_NS_dirent.h expected initializer before '*' token test line 87 1202018274031 90502
C:/ACE_wrappers/ace/OS_NS_dirent.h expected primary-expression before ',' token test line 110 1202018274046 90519
C:/ACE_wrappers/ace/OS_NS_dirent.h expected primary-expression before ')' token test line 84 1202018274031 90501
C:/ACE_wrappers/ace/OS_NS_dirent.h expected primary-expression before ')' token test line 90 1202018274031 90505
C:/ACE_wrappers/ace/OS_NS_dirent.h expected primary-expression before ')' token test line 98 1202018274046 90515
C:/ACE_wrappers/ace/OS_NS_dirent.h expected primary-expression before ')' token test line 114 1202018274046 90524
C:/ACE_wrappers/ace/OS_NS_dirent.h expected primary-expression before "long" test line 111 1202018274046 90520
C:/ACE_wrappers/ace/OS_NS_dirent.h expected primary-expression before "struct" test line 94 1202018274031 90509
C:/ACE_wrappers/ace/OS_NS_dirent.h expected primary-expression before "struct" test line 95 1202018274031 90510
C:/ACE_wrappers/ace/OS_NS_dirent.h initializer expression list treated as compound expression test line 95 1202018274046 90511
C:/ACE_wrappers/ace/OS_NS_dirent.h initializer expression list treated as compound expression test line 111 1202018274046 90521
C:/ACE_wrappers/ace/OS_NS_dirent.h ISO C++ forbids declaration of `dirent' with no type test line 49 1202018274031 90490
C:/ACE_wrappers/ace/OS_NS_dirent.h ISO C++ forbids declaration of `dirent' with no type test line 54 1202018274031 90492
C:/ACE_wrappers/ace/OS_NS_dirent.h variable or field `ace_rewinddir_helper' declared void test line 67 1202018274031 90493
C:/ACE_wrappers/ace/OS_NS_dirent.h variable or field `closedir' declared void test line 84 1202018274031 90499
C:/ACE_wrappers/ace/OS_NS_dirent.h variable or field `rewinddir' declared void test line 98 1202018274046 90513
C:/ACE_wrappers/ace/OS_NS_dirent.h variable or field `seekdir' declared void test line 110 1202018274046 90517
C:/ACE_wrappers/ace/OS_NS_signal.h `ACE_SignalHandler' does not name a type test line 127 1202018274031 90467
C:/ACE_wrappers/ace/process.h `MAXPATHLEN' was not declared in this scope test line 399 1202018274031 90482
C:/ACE_wrappers/ace/process.h `MAXPATHLEN' was not declared in this scope test line 429 1202018274031 90483
C:/ACE_wrappers/ace/signal.h `ACE_SignalHandler' does not name a type test line 215 1202018274031 90480
C:/ACE_wrappers/ace/signal.h `ACE_SignalHandler' has not been declared test line 157 1202018274031 90474
C:/ACE_wrappers/ace/signal.h `ACE_SignalHandler' has not been declared test line 167 1202018274031 90476
C:/ACE_wrappers/ace/signal.h `ACE_SignalHandler' has not been declared test line 212 1202018274031 90478
C:/ACE_wrappers/ace/signal.h `ucontext_t' has not been declared test line 32 1202018274031 90468
C:/ACE_wrappers/ace/signal.h expected `)' before "handler" test line 109 1202018274031 90470
C:/ACE_wrappers/ace/signal.h expected `)' before "handler" test line 115 1202018274031 90471
C:/ACE_wrappers/ace/signal.h expected `)' before "handler" test line 124 1202018274031 90472
C:/ACE_wrappers/ace/signal.h expected `)' before "handler" test line 134 1202018274031 90473
C:/ACE_wrappers/ace/signal.h field `sa_' has incomplete type test line 225 1202018274031 90481
C:/ACE_wrappers/ace/signal.h ISO C++ forbids declaration of `handler' with no type test line 159 1202018274031 90475
C:/ACE_wrappers/ace/signal.h ISO C++ forbids declaration of `handler' with no type test line 169 1202018274031 90477
C:/ACE_wrappers/ace/signal.h ISO C++ forbids declaration of `parameter' with no type test line 212 1202018274031 90479
C:/ACE_wrappers/ace/signal.h ISO C++ forbids declaration of `ucontext' with no type test line 32 1202018274031 90469 试试换个ACE的版本看看
回复 #1 vincentxie 的帖子
主,这个问题你解决没有,我现在也碰到这样的问题,不知道怎么办?我的邮箱:long_qingtian@126.com
有时间和我交流下,呵呵 main() 改成 ACE_TMAIN()
页:
[1]
2