分享

Building ACE on Windows using Visual Studio | Yuval Baror’s Blog

 liyan1371 2014-12-08

The Adaptive Communication Environment (ACE)  framework is an extensive set of cross-platform tools in C++. In this post I will describe in detail the steps required to set up the ACE framework on Windows using Visual Studio, and to set up a project using the ACE framework. The process is not complicated, but there are several pitfalls that one should be aware of.

Here we go!

Note: Steps 1-6 are partially covered in the ACE Build Guide. I give them here with some extra hints and tips.

  1. Download the ACE framework from here. We will be using the full version of ACE.zip (last line under “Latest Micro Release Kit”).
  2. Unzip this file into the directory where you want your ACE files to be located. I put my ACE files under C:\Programming\C++. Unzipping the file creates an ACE_Wrappers directory (C:\Programming\C++\ACE_Wrappers in my case). We’ll call this directory the ACE_ROOT directory.
  3. Go to the ACE_ROOT\ace directory (C:\Programming\C++\ACE_Wrappers\ace in my case) and create a file called “config.h”. Edit this file with notepad or any other text editor and put the following text in the file:
    #include “ace/config-win32.h”
  4. In the ACE_ROOT directory there are several solutions for different versions of Visual Studio and for different types of libraries. In this tutorial I will be using Visual C++ 2008 Express Edition (which is also called vc9) and building ACE as a static library. So the solution I  need is ‘ACE_wrappers_vc_9_Static.sln’. Select the solution that fits your needs.
    * Note: Visual Studio 2010 users can use the vc9 solutions. The Conversion Wizard will upgrade the solution to VS 2010 format.
  5. Select your configuration (Debug or Release) and build the ACE project in your solution. In my case this is ‘ACE_vc9_Static’.
    Building the ACE library
  6. After a few minutes of building, you should have the ACE library file in your ACE_ROOT\lib directory. I built using the Debug configuration, so the file that was created is c:\Programming\C++\ACE_Wrappers\lib\ACEsd.lib
  7. We are now ready to create our first ACE project! Create an empty C++ solution and then edit the project properties.
  8. In “Properties”–”C/C++”–”General”–”Additional Include Directories” add the ACE_ROOT directory.
    Additional Include Directories

  9. In “Properties”–”C/C++”–”Preprocessor”–”Preprocessor Definitions” set the following:
    ACE_AS_STATIC_LIBS
    _CRT_SECURE_NO_WARNINGS
    WIN32

    Preprocessor Definitions

  10. In “Properties”–”C/C++”–”Code Generation”–”Runtime Library” set to Multi-Threaded debug (/MTd) for the Debug configuration and Multi-Threaded (/MT) for the Release configuration.
    Code Generation
  11. In “Properties”–”Linker”–”General”–”Additional Library Directories” add the ACE_ROOT\lib directory.
    Additional Library Directories
  12. In “Properties”–”Linker”–”Input”–”Additional Dependencies” add ACEsd.lib for the Debug configuration and ACEs.lib for the Release configuration.
    Linker Input
  13. Your project is now configured to work with ACE. You can create your project code and start using the ACE framework. Following is a simple example program that runs a thread to perform some work.
    ACE Test Program

That’s all folks!

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多