System: centos 6.5 64-bit
Ace version: 6.1.0
Assume that the directory of the compressed file is/usr/local/
Step 1:
Decompress the loaded ace-6.1.0.tar.gz
# Tar zxvf ACE-6.1.0.tar.gz
A folder named ace_wrappers appears.
Step 2: Define the environment variables:
Modify/etc/profile or/etc/bashrc
# Vi/etc/profile
Add the following two lines:
Ace_root =/usr/local/ace_wrappers; export ace_root
LD_LIBRARY_PATH = $ ace_root/ace; export LD_LIBRARY_PATH
# This path is the path of the final link. If the compilation output does not modify the path, it is the above path. If the custom path is used, it must be changed to the custom path.
Step 3: Modify platform_linux.gnu,
VI platform_linux.gnu
Find
Ifeq ($ (buildbits), 32)
Flags_c_cc + =-M32
Ldflags + =-M32
Endif
Ifeq ($ (buildbits), 64)
Flags_c_cc + =-M64
Ldflags + =-M64
Endif
To:
Ifeq ($ (buildbits), 32)
Flags_c_cc + =-M32
Ldflags + =-M32
Endif
Ifeq ($ (buildbits), 64)
Flags_c_cc + =-M64
Flags_c_cc + =-FPIC
Ldflags + =-M64
Endif
The modification here is to solve the problem of 64-bit system compilation. if the system is 32-bit, it should be fine if it is not modified.
Step 4: goUnder ace_wrappers/include/makeincludeCreate the platform_macros.gnu file,
VI platform_macros.gnu
Add the following code:
Include $ (ace_root)/include/makeinclude/platform_linux.gnu // No # include
The following two items are optional:
1. install_prefix =/usr/local/ace_install
This item is output from the compilation file. If you want to add this item, you need to modify the preceding environment variable: LD_LIBRARY_PATH = $ ace_root/ace; export LD_LIBRARY_PATH. If you add this item, change it
LD_LIBRARY_PATH =/usr/local/ace_install/ace; export LD_LIBRARY_PATH
2. static_libs = 1
This defines that a static library is generated when a compilation file is generated. If no static library is added, no static library is generated.
Step 5: test example
# Include "ACE/log_msg.h"
# Include "ACE/OS _main.h"
Using namespace STD;
Int ace_tmain (INT Arg, ace_tchar * argv [])
{
Ace_debug (lm_debug, ace_text ("Hello Ace ")));
Return 0;
}
Compile and connect:
Gcc-O hello. cpp-I/usr/local/ace_wrappers/-L/usr/local/ace_wrappers/ACE/-encode-LRT-lpthread
You can read books and learn ace if there is no problem ............