window10(64bit)+VS2010編譯ACE_TAO源碼庫
1.下載
ACE+TAO下載地址:http://download.dre.vanderbilt.edu/previous_versions/
VS2010下載地址:https://pan.baidu.com/mbox/homepage?short=c1Z61lm
最新版本6.4.3是用vs2012以上版本編譯,本文介紹的ACE_TAO的版本是6.2.6,它VS編譯版本是10或11。另外,下載源碼庫最好不要帶src後綴的,sources - only包只 包含源代碼,您必須使用MPC生成自己的makefile。
不同的平臺安裝過程在 http://www.dre.vanderbilt.edu/~schmidt/ACE-install.html都有介紹,想了解的可以去看看。
2.解壓
解壓到指定目錄,如D:\ACE_TAO_6.2.6\ACE_wrappers,文件路徑最好不要帶中文字符
3.壞境變量設置
添加系統變量
ACE_ROOT:D:\ACE_TAO_6.2.6\ACE_wrappers; TAO_ROOT:D:\ACE_TAO_6.2.6\ACE_wrappers\TAO;
4.編譯ACE
1).在解壓目錄\ACE_wrappers\ace 下創建一個config.h文件,內容為: #include "ace/config-win32.h"
具體的宏定義添加意義在這裏就不詳細講解,目前我用到這些
#ifndef __ACE_CONFIG_H
#define __ACE_CONFIG_H
#define ACE_HAS_STANDARD_CPP_LIBRARY 1
#define ACE_DISABLE_WIN32_ERROR_WINDOWS
#define ACE_DISABLE_WIN32_INCREASE_PRIORITY
#define ACE_NO_INLINE
#define ACE_HAS_MFC 1
#include "ace/config-win32.h"
#endif /* __ACE_CONFIG_H */
2).用VS2010打開 D:\ACE_TAO_6.2.6\ACE_wrappers\TAO\ TAO_ACE_vc10.sln,設置ACE為啟動項,右鍵屬性:
a)VC++目錄——包含目錄 添加 $(ACE_ROOT)
b)VC++目錄——庫目錄 添加 $(ACE_ROOT)\lib
3). 生成解決方案
4).編譯成功後的文件在 ACE_wrappers\lib目錄下(建議debug和release版都生成下)
5.VS項目中使用ACE
右鍵項目屬性 ,配置
VC++ Directories-->Include Directories D:\ACE_TAO_6.2.6\ACE_wrappers
VC++ Directories-->Library Directories D:\ACE_TAO_6.2.6\ACE_wrappers\lib
C/C++-->General--> Additional include Directories D:\ACE_TAO_6.2.6\ACE_wrappers\TAO
Linker-->General -->Additional Libraray Directories D:\ACE_TAO_6.2.6\ACE_wrappers\lib
Linker-->General-->Additional Dependencies TAOd.lib ACEd.lib
以下是簡單的代碼測試以及結果:
#include "stdafx.h"
#include <iostream>
#include <tao/corba.h>
#include <tao/String_Alloc.h>
using namespace std;
#include "stdafx.h"
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
char *p = CORBA::string_alloc(5);
strcpy(p,"Hello");
cout<<p<<endl;
CORBA::string_free(p);
CORBA::String_var s = CORBA::string_dup ("world");
cout<<s.in()<<endl;
cout<<p<<endl;
getchar();
return 0;
}
參考:http://blog.csdn.net/kaci_csdn/article/details/52535589
window10(64bit)+VS2010編譯ACE_TAO源碼庫