ace 安裝 使用

2021-06-21 13:15:00 字數 2926 閱讀 5573

the adaptive communication environment (ace) 是一套免費的、開源的物件導向框架,它為大規模併發通訊軟體實現了許多核心的設計模式。ace提供了一套豐富的、可重用的c++封裝類和框架元件,並且可以跨平台實現大多數常見的通訊軟體的功能。本文將通過幾個非常簡單,並且可以說是粗糙的小例子,為大家講述ace的安裝及配置過程。通過這些簡單的小例子,帶領大家以最快的速度進入ace的世界。我們第一步的目的就是不求完美,但求入門。

首先我要先介紹一下本文所使用的環境,以後本文所提到的所有細節都要和這個環境相匹配,如果大家在安裝配置時遇到問題,也可以用qq(21807822)或blog(和我聯絡。我使用的是aix 5.3 windows xp home ace 5.5 visual studio.net 2003 如果環境不完全匹配,則安裝過程會有少許的不同。

我們先以windows平台為例說明。用winzip解壓ace-5.5.zip,硬碟最好保留2g以上的空間。我保留的是8個g(畢竟還要幹別的嘛),解壓後的目錄類似

ace_root的目錄,你應該根據自已的系統進行修改。aix下使用的makefile檔案內容如下:

all: test1

test1:test1.o

xlc_r -o test1 test1.o -l$/build/ace/.libs/ -lace

test1.o:test1.cpp

xlc_r -c -o test1.o -i$ test1.cpp

clean:

rm -f test1 *.o

// fuzz: disable check_for_streams_include

#include "ace/streams.h"

#if defined (ace_win32) && (!defined (ace_has_standard_cpp_library) || /

(ace_has_standard_cpp_library == 0) || /

defined (ace_uses_old_iostreams))

# include

#else

# include

#endif

iresult = iaserver.set(nport, pserverhost);

if (iresult == -1)

ace_error_return ((lm_error, "lookup %s, %p/n", pserverhost, nport), 1);

if ( scconnector.connect(ssstream, iaserver) < 0 )

ace_error_return ((lm_error, "%p/n", "connect()"), 1);

strcpy(szbuffer, ptext) ;

ssstream.send_n(szbuffer, strlen(ptext)) ;

memset(szbuffer, 0, sizeof(szbuffer)) ;

iresult = ssstream.recv_n(szbuffer, 1024) ;

nlength = strlen(szbuffer) ;

ace::write_n(ace_stdout, "recv --> " , 9) ;

ace::write_n(ace_stdout, szbuffer, nlength) ;

ace::write_n(ace_stdout, "/n", 1) ;

return 0 ;

}#include "ace/streams.h"

int displaytime(char* ptime) ;

int main(int argc, char *argv)

while(server.accept(stream)!=-1)

server.close();

return 0;

}int displaytime(char* ptime)

在aix上安裝,要先設定ace_root,方法在上面的setenv.sh裡有語句。

第二步也和windows一樣要生成config.h。我們使用的是aix 5.3,所以我是要在config.h裡包含config-aix-5.x.h檔案即可

第三步進入$/include/makeinclude目錄,建立乙個名為platform_macros.gnu的檔案,在其中包含如下一行

include $(ace_root)/include/makeinclude/platform_aix.gnu,另外還有乙個方法是用ln -s platform_aix.gnu platform_macros.gnu

下一步,我們在$目錄裡新建乙個目錄 build。然後cd build。在build目錄裡執行 ../configure,等待一段時間之後,我們再make一下就可以生成ace了

在aix上的安裝過程就到這裡了,下一步,你可以用上面的setenv.sh來初始化環境變數,其實也就是指定ace_root和ld_library_path兩個目錄。

2、在$/ace目錄裡,新建config.h,加入#include "config-aix-5.x.h"語句。

或者不願意生成檔案就用 ln -s config-aix-5.x.h config.h

3、在$/include/makeinclude目錄,新建platform_macros.gnu,加入include $(ace_root)/include/makeinclude/platform_aix.gnu

當然你也可以用ln -s platform_aix.gnu platform_macros.gnu 來做到相同的效果

4、在$裡新建乙個目錄 build

5、在build裡敲 ../configure (注意,要有兩個點)

6、configure成功之後,再make,就大功告成。

7、測試,按上文說法設定ld_library_path,再用上面的源**和makefile嘗試編譯,鏈結,執行吧。

ACE 6 0 0 編譯安裝使用

win7 vs2010 ace 6.0.0 新增環境變數 path ace root lib ace root ace目錄下新建config.h檔案,檔案內容 config.h define ace has standard cpp library 1 用於標準c 跨平台 include ace c...

ACE編譯安裝

tar zxf ace 6.1.0.tar.gz 2.設定環境變數 vim bashrc export ace root home yourname export ld library path ld library path ace root ace 3.建立檔案 ace root ace con...

ubuntu安裝ACE過程

安裝ace,最簡單的方法,是直接apt get安裝 cpp view plain copy sudo apt get install libace dev 這樣,ace檔案則位於 usr include下,libace.so位於 usr lib下,樓主機器的libace dev版本為5.6.3 6 ...