VC6下配置ACE的详细过程
自己作一个config.h 里面要有
#include "ace/config-win32.h"
如果是win98/me的话再加上
#define ACE_HAS_WINNT4 0
然后打开ace.dsw,进行批生成(可以选择生成的库,比如(static)debug/release等,实在不行你就全生成得了)。之后会在ace目录下生成所需的.dll和.lib。
再设置一下编译环境就好了。
这是详细的介绍,在ACE_INSTALL.html里:
Building and Installing ACE on Windows with Microsoft Visual C++
Note concerning MSVC 5.0 and Service Pack 3: There has been confusion regarding MSVC 5 and its Service Pack 3. Some ACE users have, in the past, had problems with SP3 that were not present in SP2. Thanks to the diligent efforts of Bill Fulton, the mystery appears to be solved. The key? (Oh, this is a good one...) It would appear that there are actually multiple versions of SP3 in existence. The earlier ones have the bug, while later ones have it fixed. The service pack downloadable from Microsoft's web site as of June 16, 1998 works fine. The CD containing SP3, if it has part number X03-50158 on the disc (the part number on the jacket is probably different), also works fine. Note, however, that regardless of the version of SP3, there are some STL bugs in SP3 which you should get corrected. Please see dinkumware/vc_fixes.html for details. Thank you to Ben Eng for the pointer to the STL fixes.
Right now there is a SP4 (and hopefully only one of them) which fixes a deadlock problem in the STL.
We no longer actively support MSVC++ 5.x or earlier. ACE might work with these compilers but probably not without a bit of effort.
Uncompress the ACE distribution into a directory, where it will create a ACE_wrappers directory containing the distribution. The ACE_wrappers directory will be referred to as ACE_ROOT in the following steps -- so ACE_ROOT\ace would be C:\ACE_wrappers\ace if you uncompressed into the root directory.
Create a file called config.h in the ACE_ROOT\ace directory that contains:
#include "ace/config-win32.h"
Now load the workspace file for ACE (ACE_ROOT\ace\ace.dsw).
Each project will contain several different configurations. These are a mixture of Debug/Release, MFC/Non-MFC, and Static/Dynamic library versions. Make sure you are building the one you'll use (for example, the debug tests need the debug version of ACE, and so on). All these different configurations are provided for your convenience. You can either adopt the scheme to build your applications with different configurations, or use ace/config.h to tweak with the default settings on NT.
Note: If you use the dynamic libraries, make sure you include ACE_ROOT\lib in your PATH whenever you run programs that uses ACE. Otherwise you may experience problems finding ace.dll or aced.dll.
If you are building for Windows NT 4 or later (Windows 2000, XP, etc.) then you can start building without anymore changes. If yo
u are building on Windows 9x/Me, then you should add the line
#define ACE_HAS_WINNT4 0
before the #include statement in ACE_ROOT\ace\config.h and it will turn off some WinNT/Win2K-specific code in ACE.
If you want to use the standard C++ headers (iostream, cstdio, ... as defined by the C++ Standard Draft 2) that comes with MSVC, then add the line:
#define ACE_HAS_STANDARD_CPP_LIBRARY 1
before the #include statement in ACE_ROOT\ace\config.h.
To use ACE with MFC libraries, also add the following to your config.h file. Notice that if you want to spawn a new thread with CWinThread, make sure you spawn the thread with THR_USE_AFX flag set.
#define ACE_HAS_MFC 1
By default, all of the ACE projects use the DLL versions of the MSVC run-time libraries. You can still choose use the static (LIB) versions of ACE libraries regardless of run-time libraries. The reason we chose to link only the dynamic run-time library is that almost every NT box has these library installed and to save disk space. If you prefer to link MFC as a static library into ACE, you can do this by defining ACE_USES_STATIC_MFC in your config.h file. However, if you would like to link everything (including the MSVC run-time libraries) statically, you'll need to modify the project files in ACE yourself.
Static version of ACE libraries are build with ACE_AS_STATIC_LIBS
defined. This macro should also be used in application projects that link to static ACE libraries
Optionally you can also add the line
#define ACE_NO_INLINE
before the #include statement in ACE_ROOT\ace\config.h to disable inline function and reduce the size of static libraries (and your executables.)
ACE DLL and LIB naming scheme:
We use the following rules to name the DLL and LIB files in ACE when using MSVC.
"Library/DLL name" + (Is static library ? "s" : "") + (Is Debugging enable ? "d" : "") + {".dll"|".lib"}
More information for ACE/TAO on MSVC can be found here. The doxygen version of this document is available under Related Topics in the ACE Library.
1.下载最新的ACE Release版本压缩包,解压后目录为: ACE-版本号\ACE_wrappers\
2.加载工程文件,目录: ACE_wrappers\ace\ace.dsw
3.新建 config.h 文件到 ACE_wrappers\ace目录下
4.添加包含头文件声明: #include "ace/config-win32.h"
5.添加宏定义 (注意:添加在 #include 之前)
(1).#define ACE_HAS_WINNT4 0 //OS不是NT4.0或以后版本
(2).#define ACE_HAS_STANDARD_CPP_LIBRARY 1 //使用标准C++库
(3).#define ACE_HAS_MFC 1 //使用MFC库
(4).#define THR_USE_AFX 1 //使用CWinThread产生新的线程类
(5).#define ACE_USES_STATIC_MFC 1 //静态连接MFC库
(6).#define ACE_AS_STATIC_LIBS 1 //生成静态的ACE库
(7).#define ACE_NO_INLINE //是否使用内联函数在静态库内
6.编译得到.lib和.dll文件
好象使用时有个问题,不知道大家有没有碰到过:
1. 在使用ACE发布Release版本程序时
,TryEnterCriticalSection导致无法编译的问题
解决方法:
(1). 工程 Project-->setting-->C/C++ 写入:_WIN32_WINNT=0x0500
(2).包含头文件为:windows.h
如果有“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: 's
上一篇:
VC6[1]0的最全快捷键和若干实用小技巧_vc代码
下一篇:
政府形象媒体危机的处置策略研究