ACE在VC6.0中工程的设置问题

zhuchaodiyu 2004-09-17 04:41:27
我的ACE库已经正确安装配置,Samples都可以正常编译运行,但我自己写的程序却出现形如:
Linking...
tftp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) int __cdecl ace_os_main_i(class ACE_Main_Base &,int,char * * const)" (__imp_?ace_os_main_i@@YAHAAVACE_Main_Base@@HQAPAD@Z)
tftp.obj : error LNK2001: unresolved external symbol "int __cdecl ace_main_i(int,char * * const)" (?ace_main_i@@YAHHQAPAD@Z)
Release/tftp.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.

的错误,请问怎么解决。最好请大侠详细说一下关于工程的设置问题。
...全文
462 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
a1m 2005-08-21
  • 打赏
  • 举报
回复
楼主的问题是:dll连接库的编译连接问题.windows下要注意带符号问题.UNIX下则无关.
$ace_root/bin/generate_export_file.pl的perl脚本运行.呢感在命令行上指定dll助记符.该脚本会产生一个与平台无关的头文件.并输出到mnemonic_export.h的文件.
qianyong325 2005-01-14
  • 打赏
  • 举报
回复
mark
yuanye2008 2004-09-22
  • 打赏
  • 举报
回复
接贵帖问一下:
ace的库在哪能找到?
yuanye2008 2004-09-22
  • 打赏
  • 举报
回复
ace的库什么地方有?
可以另开帖送分!
qwertasdfg123 2004-09-21
  • 打赏
  • 举报
回复
在Ace中main是进行了宏替换的。
它必须加上入口参数。
如下

int main(int argc, char **argv)


zhuchaodiyu 2004-09-18
  • 打赏
  • 举报
回复
#include "ace/INET_Addr.h"

int main()
{
return 0;
}
以上代码是为了测试ACE环境是否可用,可是构建时出现以下错误:

Linking...
tftp.obj : error LNK2001: unresolved external symbol "int __cdecl ace_main_i(int,char * * const)" (?ace_main_i@@YAHHQAPAD@Z)
Release/tftp.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

tftp.exe - 2 error(s), 0 warning(s)

我以经添加了库,设置工程-设置-C/C++: Code Generation - Use run-time library : Debug Multithreaded Dll,请问还要做什么?
另:加个#include "ace/OS_main.h" 并没有解决这些错误。
zhuchaodiyu 2004-09-18
  • 打赏
  • 举报
回复
别沉啊,大家帮下忙啊,解决了马上给分!
2608 2004-09-17
  • 打赏
  • 举报
回复
补充一下:假设 ace 安装在 D:\ACE_wrappers\ace
qwertasdfg123 2004-09-17
  • 打赏
  • 举报
回复
程序入口错误了.
加个
#include "ace/OS_main.h"
ynotgo 2004-09-17
  • 打赏
  • 举报
回复
楼上高人

在BCB中编译ACE的方法:
新建一个console Application,建立时确保选中Multi Threaded,设置相应的Include和Library路径。
如果是Releaes Build,添加ace_b.lib到工程中,或者在头文件中添加 #pragma link "ace_b.lib"也可以。
如果是Debug Build,则换成ace_bd.lib。

一般来说编译里面的例子都需要
#include "ace/OS.h"
#include "ace/Log_Msg.h"
如果发现程序中没有,则添加上去。

不知道VC中的对应设置,不过楼主应该知道吧
2608 2004-09-17
  • 打赏
  • 举报
回复
如果有“Cannot open include file: 'ace/SOCK_Acceptor.h': No such file or directory”
工程-设置-C/C++: Preprocessor,附加包含路径:D:/ACE_wrappers

如果有“ You must link against multi-threaded libraries when using ACE (check your project settings)”
工程-设置-C/C++: Code Generation - Use run-time library : Debug Multithreaded Dll

如果有“error C2065: 'ACE_ERROR' : undeclared identifier”
error C2065: 'ACE_DEBUG' : undeclared identifier
#include "ace/Log_Msg.h"

error C4716: 'ace_main_i' : must return a value
在main中加入
return 0;

“error LNK2001: unresolved external symbol "__declspec(dllimport) int __cdecl”
工程-设置-Link-Input: 对象/库模块:添加aced.lib 附加库路径:D:\ACE_wrappers\ace



编译client中遇到的问题
1、error C2039: 'sprintf' : is not a member of 'ACE_OS'

#include "ace/OS_NS_stdio.h"

2、error C2039: 'strlen' : is not a member of 'ACE_OS'

#include "ace/OS_NS_string.h"
3、error C2059: syntax error : '?'
错误在这一句: ACE_DEBUG((LM_DEBUG,?Usage egX <hostname> <port_number>\n?));
将?改为"

4、无法找到动态链接库aced.dll于指定的路径
为系统变量PATH加上D:\ACE_wrappers\bin



静态包含:
工程-设置-C/C++-预处理程序定义中加入 ,ACE_AS_STATIC_LIBS

yedp 2004-09-17
  • 打赏
  • 举报
回复
库路径设了吗?
飞在天空的鱼 2004-09-17
  • 打赏
  • 举报
回复
同上
daylove 2004-09-17
  • 打赏
  • 举报
回复
还没有接触ACE的知识,顶了在说,

24,855

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 工具平台和程序库
社区管理员
  • 工具平台和程序库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧