下載地址: http://download.dre.vanderbilt.edu/
ACE版本:ACE-6.2.2.tar.bz2
下載完成後解壓路徑爲:/root/ACE/ACE_wrappers
設置環境變量:
vi .bashrc,添加的內容爲:
- export ACE_ROOT=/root/ACE/ACE_wrappers
- export MPC_ROOT=$ACE_ROOT/MPC
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ACE_ROOT/ace:$ACE_ROOT/lib:/usr/local/lib
- source .bashrc
1.選擇平臺配置文件,本系統應該選擇config-linux.h,進入$ACE_ROOT/ace,執行命令:
- cp config-linux.h config.h
2.選擇平臺宏定義文件,本系統選擇platform_linux.GNU,在$ACE_ROOT/include/makeinclude 目錄下新建
platform_macros.GNU,但是該目錄下面有platform_macros.GNU:
- [root@vm makeinclude]# ll platform_macros.GNU
- lrwxrwxrwx 1 root root 36 11-06 12:27 platform_macros.GNU -> ../../apps/gperf/platform_macros.GNU
- cp /root/ACE/ACE_wrappers/include/makeinclude/platform_linux.GNU /root/ACE/ACE_wrappers/apps/gperf/platform_macros.GNU
3.進入$(ACE_ROOT)/ace/, 輸入編譯命令:make -f GNUmakefile, 開始編譯libACE.so和libACE.so.6.2.2
Linux使用ACE編程:
我寫個簡單的Hello World!的程序
1.新建個hello.cpp的文件:
- #include "ace/Log_Msg.h"
- int ACE_TMAIN(int argc, int argv[])
- {
- ACE_DEBUG((LM_DEBUG, ACE_TEXT("Hello World!\n")));
- return 0;
- }
- project(hello) : aceexe{
- exename = hello
- Source_Files{
- hello.cpp
- }
- Header_Files{
- }
- }
- $ACE_ROOT/bin/mpc.pl -type make hello.mpc
5.運行:
- [root@vm ~]# ./hello