build ace随时更新

本文详细介绍了ACE库在Windows和Linux平台上的编译步骤,并提供了如何在项目中使用ACE库的具体指导,包括配置环境变量、修改配置文件以及编写Makefile等内容。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、编译ace-6.0.2

win32
在$ace_root$ace下面增加config.h文件,添加内容如下

#pragma once

//#define ACE_USES_WCHAR   //使用unicode字符集
#define ACE_HAS_MFC 1   //是否使用mfc
#include "ace/config-win32.h"
打开对应的项目/工程文件,编译

在default_constants.h中修改
# if !defined (ACE_DEFAULT_ASYNCH_BACKLOG)
#   define ACE_DEFAULT_ASYNCH_BACKLOG SOMAXCONN/*5更改最大*/
# endif /* ACE_DEFAULT_ASYNCH_BACKLOG */


linux
#tar -jxf  ACE-xxx.tar.bz2
加环境变量
export ACE_ROOT=/home/lsl/ACE_wrappers
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ACE_ROOT/ace
到用户的profile文件

#cd /home/userxxx/ACE_wrapper
#mkdir build
#cd build
#../configure --enable-ssl=no --enable-gperf=no --enable-static=yes --cache-file=linux.cache
--enable-ssl表示openssl支持
--enable-gperf表示gperf库支持
--enable-static表示编译静态库,默认只编译动态库,考虑开发使用可能会用到静态版本
--cache-file表示配置脚本输出的结果文件,中断后继续执行配置脚本时可节省时间

configure过程中如果出现event poll测试失败,执行
echo "ace_cv_linux_event_poll=true" > linux.cache

然后继续configure

最后#make && make install


2、使用
(1)编写使用了ACE的代码
(2)编写Makefile

BIN = hello_ace
FILES = Piece2 Piece3
SRC= $(addsuffix .cpp,$(FILES))
OBJ= $(addsuffix .o,$(FILES))
BUILD   = $(VBIN)
#---------------------------------------------------------
# Include macros and targets
#---------------------------------------------------------
include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU
include $(ACE_ROOT)/include/makeinclude/macros.GNU
include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU
include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU
include $(ACE_ROOT)/include/makeinclude/rules.local.GNU

以上的Makefile包含3个cpp文件hello_ace.cpp、Piece2.cpp和Piece3.cpp

(3)编译
#make


win7, ace-6.0.2, vs2008sp1,vs2010

设置如下:

  1. Set the DE>SSL_ROOTDE> environment variable to the location of the directory containing the OpenSSL DE>inc32DE> and DE>out32dllDE> directories.
  2. Add DE>ssl=1DE> to your MPC DE>$ACE_ROOT/bin/MakeProjectCreator/config/default.featuresDE> or DE>$ACE_ROOT/local.featuresDE> file, and re-run MPC to add support for building the ACE_SSL library to your MSVC++ workspaces and projects.
  3. Open the DE>ACE.slnDE> solution, and refer to the ACE build and installation instructions above for details on creating a DE>config.hDE> configuration header for this platform. Once the DE>config.hDE> file has been created, build the DE>ACE_SSLDE> project.

 


ACE和MFC配合,或者使用mpc生成工程

在Windows下安装Perl环境,然后重启。然后执行下面命令
    cd %ACE_ROOT%
    perl bin\mwc.pl -type vc9 -value_template "configurations = 'MFC Release' 'MFC Debug' Release Debug"  ace/ace.mwc
    然后打开%ACE_ROOT%/ace/ace.sln,编译MFC两个工程,生成ACEmfc.lib及dll就可以了,然后使用前调用:ACE::init(),使用后调用 ACE::fini()。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值