win7+visual+studio+2010下安装和配置ace和boost

来源:互联网 发布:淘宝童装批发商城 编辑:程序博客网 时间:2024/05/21 09:32

1.  Ace

1.1.  Win7+Visual Studio2010编译

  1. 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.

///将ACE5.8 source kit(zip file).zip解压缩到 C:\ ACE5.8source kit下;

            目录宏ACE_ROOT =C:\ACE5.8source kit\ACE_wrappers

 

  1. Create a file     called config.h in the ACE_ROOT\ace directory that contains:
        
         #include "ace/config-win32.h"

////在目录ACE_ROOT下新建文件config.h,文件中内容为:

////#include"ace/config-win32.h"

  1. The static,     DLL and MFC library builds are kept in different workspaces. Files with     names *_Static contain project files for static builds. Workspaces for     static and DLL builds will be available through the stock release at DOC     group's website.
  2. Now load the     solution file for ACE (ACE_ROOT/ACE.sln).

e.g.   ACE_vc9_Static.sln 

  ////使用visual studio 2010加载ACE_vc9_Static.sln,并编译,耗时

 ////较长,生成ACE_ROOT/lib下有ACEsd.lib

  1. Make sure you     are building the configuration (i.e, Debug/Release) 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.

////需要解释一下,vs的编译模式有两种:上面一种是生成静态库ACEsd.lib,其他程////序使用时,只需要在配置加载这个静态库,这个静态库就被加载到新程序中了,此////时需要将vs的编译对应设为静态模式。下面vs有详细介绍

////另外一种是动态库;这里就不介绍了。

2.  Boost

 

2.1.  Install In Windows

 

–      1:执行C:\Program Files\Microsoft Visual Studio 10\VC\vcvarsall.bat

–      2:cd D:\Software\boost_1_44_1\tools\build\jam_src中执行build_dist.bat,生成bin.ntx86\bjam.exe

–      3:将bjam.exe考到D:\Software\boost_1_44_1下

–      4:.Net中Tools中打开command

–      cd D:\Software\boost_1_33_1

–      bjam "-sVC80_ROOT=C:\Program Files\Microsoft Visual Studio8\VC" "-sTOOLS=vc-8_0" "--prefix=D:\Software\boost_1_33_1" install

–      J:\public\boost_1_44_0> –bjam "-sVC100_ROOT=D:\ProgramFiles\Microsoft Visual Studio 10\VC" "-sTOOLS=vc-10_0" "--prefix=J:\public\boost_1_44_0" install

注意在。net中必须对应选择Multi-threaded Debug (/MTd)

 

3.  Visual  Studio

3.1.  设置

Configuration Type:Staticlib  和App

VC++ Directory   :include 和library需要添加ace、cppunit、boost的相关目录

Preprocessor Difinition:增加ACE_AS_STATIC_LIBS

Runtime Library:  MTd

 

 

3.1.1.  Property Manage

首先要讲的是以前版本的visual studio,Tools-》options->Project Solution->VC++ directions无法使用了。郁闷吧。Followme!

第一步:选择View(视图)找到Property manage(属性管理器)。

网上都这么说,但是你会发现内容为空,第二次郁闷吧。其实很简单,随便打开或者新建一个项目,然后就可以打开了,呵呵。

第二步:选择View(视图)找到Property manage(属性管理器),注意不是属性窗口(property Window)也不是property page(属性页)。是不是找不到(呵呵,第二次郁闷吧)。

注意了,View中找到other windows(其他窗口)中能找到Property manage。这个功能在岗安装好时,是出现在在other windows中的,使用了几次后,就会从view直接看到了。呵呵

第三步:属性管理器中,找到通用而不是单个项目的VC++ Directory设置。

按照网上的教程,发现这个图中的Common Properties没有你要的东西(第三次郁闷,呵呵)。

注意了:想得到下面图中的效果吧_^_^!

 

按照红色标志,依此点击小三角,最后选择双击“Microsoft.Cpp.Win32.user”,就可以设置全系统所有项目共用的效果了。

第四步:编译一个项目,发现property manage的修改没有生效(第四次郁闷)。

注意了,点击修改保存,重启visual studio 。怎么样,生效了吧。呵呵

 

1.1.  使用

1.1.1.  Visual  Studio

 

1:

Make sure you are building theconfiguration (i.e, Debug/Release) the one you'll use (for example, the debugtests need the debug version of ACE, and so on). All these differentconfigurations are provided for your convenience. You can either adopt thescheme to build your applications with different configurations, or useace/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 thatuses ACE. Otherwise you may experience problems finding ace.dll or aced.dll.

 

 

如果用ace。vcproj,则需将生成的dll考到syste32下,否则会在执行时,报错

使用Static无需。

 

2:用Static的项目

1):Preprocessor必须定义ACE_AS_STATIC_LIBS

 

 

Static version of ACE libraries are builtwith ACE_AS_STATIC_LIBS

defined. This macro should also be used inapplication projects that link to static ACE libraries

 

2):Preprocessor中_WINDOWS改成_CONSOLE

         System中WINDOWS改成CONSOLE

Runtime Library:Multi-threadedDebug (/MTd)

 

3):VC++ Directionries-》includedirectories

添加ace 、boost 、cppunit的头文件目录定义

 

4):VC++ Directionries-》include directories

添加ace 、boost 、cppunit的lib库目录定义

 

3):main函数必须用

int main(int argc,char **argv)

不能用 main()

 

4):静态库:ACEsd.lib

注意Runtime library必须和编译的ace环境一致

 

 

原创粉丝点击