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.
- Download the ACE framework from here. We will be using the full version of ACE.zip (last line under “Latest Micro Release Kit”).
- 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.
- 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:
- 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.
- Select your configuration (Debug or Release) and build the ACE project in your solution. In my case this is ‘ACE_vc9_Static’.
- 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
- We are now ready to create our first ACE project! Create an empty C++ solution and then edit the project properties.
- In “Properties”–“C/C++”–“General”–“Additional Include Directories” add the ACE_ROOT directory.
- In “Properties”–“C/C++”–“Preprocessor”–“Preprocessor Definitions” set the following:
- 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.
- In “Properties”–“Linker”–“General”–“Additional Library Directories” add the ACE_ROOT\lib directory.
- In “Properties”–“Linker”–“Input”–“Additional Dependencies” add ACEsd.lib for the Debug configuration and ACEs.lib for the Release configuration.
- 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!