This article is divided into two parts. Part 1: how to install ACE (in fact, how to compile it) Part 2: How to Use aceSource codeThe following is an example of how to use it)
--------------------------------- Part 1: how to install ACE (actually how to compile it )-----------------------------------
(1) This ace homepage is very difficult. First, let's take a look at the excerpt from the Internet.
Home Page
Ace home: http://www.cs.wustl.edu /~ Schmidt/ace.html, where you can obtain the latest version of ACE and other related resources.
Related Websites:
Ace developer http://www.acejoy.com/
Douglas Schmidt's home page http://www.cs.wustl.edu /~ Schmidt
Ace-5.4 + Tao-1.4 + CIAO-0.4 documentation http://www.huihoo.com/ace_tao/ACE-5.4-html/html/index.html
Product homepage. Ace-the adaptive communication environment http://www.cs.wustl.edu /~ Schmidt/ace.html
. Jace-Java ace http://www.cs.wustl.edu /~ Eea1/jace.html
. Tao-Real-Time CORBA with Tao (TM) (the ace orb) http://www.cs.wustl.edu /~ Schmidt/tao.html
. Ciao-component-integrated ace orb http://www.cs.wustl.edu /~ Schmidt/ciao.html
. Jaws-a high-performance, Self-Adaptive Web server built using the architecture components and patterns provided by Ace, Jaws is constructed into a "architecture" http://www.dre.vanderbilt.edu/JAWS/
. Real-Time ORB http://zen.ece.uci.edu implemented by Zen-Java/
. POSIX ace-(PACE) project is an operating system image extraction layer http://www.cs.wustl.edu designed for lightweight systems /~ Schmidt/ace_wrappers/PACE/docs/www/related resources and projects: the CORBA & CORBA Component Model (CCM) page http://ditec.um.es /~ Dsevilla/ccm/
Openccm-the Open CORBA component model platform http://openccm.objectweb.org/
Starccm, an CORBA Component Model Research Project (including OTs and PSS), funded by Chinese 863 Hi-tech research program. Core designer/core developer. http://sourceforge.net/projects/starccm/
Agent and distributed objects Quality of Service (QoS) http://www.atl.external.lmco.com/projects/QoS/
Posa1, posa2 documents http://www.huihoo.com/download/ace-tao/posa.ppt http://www.huihoo.com/download/ace-tao/posa2.ppt
(2) After referring to the above website, 1st users may not be able to tell right or wrong. The following describes how to perform step-by-step operations.
Step 2: Go to this website to download http://download.dre.vanderbilt.edu/
Download ace-6.0.0.tar.gz. (There are a lot of above. You can select it as needed. If you use it for 1st times, use it first)
Step 2: Decompress the package to D: \ ace_wrappers_6_0_0.
Some people may not understand what these items are for 1st times. I will extract them from the Internet and give a brief description.
The ace_wrappers subdirectory contains seven directories:
O ace contains the source code of the ACE Toolkit
O bin contains many useful and practicalProgram
O apps contain many Ace-based applications, such as gateway message routing.
O Docs contains information related to various aspects of ACE, such as its coding guidelines
O examples contains many examples to demonstrate how to use ACE classes and frameworks
O tests regression testing suite containing ace
Step 2 Compilation
1. Create a head file in the D: \ ace_wrappers_6_0_0 \ ACE directory named config. h with the following content: # include "ACE/config-win32.h" (required)
2. load the ACE project file (ace_root \ ACE. DSW), compile in the release and debug modes to obtain the corresponding library file (Ace. DLL, Ace. lib and aced. DLL, aced. lib), where ace. DLL, Ace. lib is generated by the release version, aced. DLL, aced. lib is generated by debug. Specific Operation Method: run VC ++, select build-> batch build ..., Select All ACE-Win32 debug and ACE-Win32 release, rebuild all. note: I am using the vs2010 Chinese version, and load the ACE project file (ace_root \ ACE \ ace_vc10.sln) in VC ++, which may be slightly different from the above, but the general meaning is the same as above. In addition, you may be confused about ace_root, which is described below. Let's take a look at how to generate the next batch,
Click Generate-> batch generate-> select Win32 (if the system is 64-bit, select x64)-> Generate or regenerate
After the compilation is successful (it may take about 30 minutes to compile, depending on the machine performance), data is imported into the database in the path D: \ ace_wrappers_6_0_0 \ Lib (. lib) and link library (. DLL ),
Note: The DLL Dynamic Link Library Under liunx is. So, the installation is completed after the suffix is reached. In fact, it is compiled. Nothing.
Comparison between ACE and VS: VS is a compilation tool and Ace is a library
The difference is: VS compiled for you, directly writeCodeHowever, Ace requires users to compile their own tools and set up the system environment (the whole process is very esoteric, but it is actually complicated to compile a simple thing, But ace is cross-platform, can Understand), after reading how to use the following, you will have a preliminary understanding of the entire process.
----------------------------------- Part 1: How to use ACE -----------------------------------
There are two examples in total: Example 1, source code example 2 on ACE, which is written separately by yourself.
-------------------- Example 1: Here we use the logger case under D: \ ace_wrappers_6_0_0 \ examples --------------------
First, copy it from the ace directory to another place (do not place it in the original directory, because the original version references the file and the library file ).
Open with vs2010
Error 1:
3> initializebuildstatus: 3> creating "Debug \ logger_simple_server_vc10 \ i386 \ logger_simple_server.unsuccessfulbuild" because "alwayscreate" is specified ". 3> clcompile: 3> logging_acceptor.cpp 3> F: \ Vc test \ logger \ simple-Server \ logging_acceptor.cpp (3): Fatal error c1083: Unable to open including files: "ACE/wfmo_reactor.h": no such file or directory 3> logging_handler.cpp 3> F: \ Vc test \ logger \ simple-Server \ logging_handler.cpp (3): Fatal error c1083: unable to open include file: "ACE/log_msg.h": no such file or directory 3> server_loggerd.cpp 3> F: \ Vc test \ logger \ simple-Server \ server_loggerd.cpp (10 ): fatal error c1083: Unable to open include file: "ACE/get_opt.h": no such file or directory solution:
Put it in attributes
Directory D: \ ace_wrappers_6_0_0
Library Directory D: \ ace_wrappers_6_0_0 \ Lib
Of course, if you do not want to copy the file to another directory, compile the file directly in the example in the ace original directory. This error will not be reported because the path has been specified .. /.. /.. /lib: The LIB of the lower-level directory of the upper-level directory, so no error will be reported during direct compilation (refer)
Error 2:
Aced. dll cannot be found,
This problem: the solution is to start from the source.
First, you must understand the DLL history.
Excerpt: Sun Xin <VC ++ in-depth explanation> Chapter 4 page 1
All functions of Windows APIs are included in the DLL, of which three are the most important.
Kernel32.dll, user32.dll, and gdi32.dll static library and dynamic library
Static Library
Release file). When releasing a product, you only need to publish this executable file and do not need to publish the used static library.
Dynamic library
When using a dynamic library, we usually provide two files: one imported database (. lib) file and a DLL (. DLL) file. although the suffix of the import library is also "lib", the import library file of the dynamic library is essentially different from the static library file. For a DLL, the import library file (. lib) contains the name of the function and variable exported by the DLL, and. the DLL file contains the actual functions and data of the DLL. when a dynamic library is used, you only need to link the DLL import file when compiling the executable file. The function code and data in the DLL are not copied to the executable file, it is not until the executable program runs, that the required DLL is loaded, the DLL is mapped to the address space of the process, and then the exported function in the DLL is accessed. at this time, in addition to the executable file, the dynamic link library to be called by the program will also be released when the product is released.
Secondly, the default Runtime Library of the source code program is multi-thread debugging DLL,
Here it is obviously a dynamic library, and the basis of the dynamic library is also discussed above. Here it mainly contains the Lib. Directory, which has already been mentioned clearly.
The link can also pass normally during compilation, which indicates that the Lib is correct. Obviously, this DLL is fixed during the 1st "installation" of ACE.
Solution: Release 1.Put the aced.dllin the same directory as .exe, so that no error will be reported when running the executable program.
Method 2. Place the aced. dll in the c: \ windows \ system32 directory.
Method 3. Modify system parameters. The following is an excerpt
Cannot find the dynamic link library named "aced. dll" in the specified path? Add D: \ ace_wrappers \ bin to the system variable path for 1st times. It doesn't matter. Follow the silly steps below. After reading it, you will
Desktop> my computer> Properties> advanced> environment variables, two options are displayed.
1st: administrator user variable ---> This indicates that only the super administrator is set for a separate user. If there is a guest user, it is a separate Guest user.
2nd: System variables ---> This is global. All super administrators and guests
Select 2nd system variables-> Find path and open the pop-up variable name: PATH variable value :.....
Add the following format: + path
; D: \ ace_wrappers_6_0_0 \ Lib
Copy this to the end ,:
Any method can run the program.
Here, we will also talk about ace_root. Why do we need to add this to the system variables? We have also added ace_root2 for reference. in fact, it is nothing more than a path name. but its most important function is portability. because Ace is designed to be cross-platform, it is normal to add this system variable.
Excerpt:
Environment Settings
You may want to register some environment variables to point to the root directory where you installed ogre, so that you can associate all your paths with this variable. In this way, you can easily locate these paths when you move these things elsewhere or on another machine. For more information about how to view and modify environment variables, see Windows, Linux, and Mac OSX.
- If you have downloaded and installed the pre-compiled version (precompiled) Ogre SDK, you should have an environment variable named 'gre _ home, it points to the folder where you installed ogre. If not, you may have installed ogre in another user of the system. Just define the ogre_home environment variable manually.
- If you download the source code version, you should register a new environment variable ogre_src to point to the 'ogrenew 'folder in the Ogre source code.
This is why the system variable ace_root should be added!
------------------ Example 2 :--------------------
Example 2: the ratio of sub-1 is one point.
First: System Configuration environment:
Variable name ace_root variable value D: \ ace_wrappers_6_0_0
Variable name PATH variable value added later; % ace_root % \ Lib
The rest are basically the same as above. but it is recommended that the library path be unified. to facilitate cross-platform performance (for example, if a company writes a program, it can directly copy the program to the dormitory without configuring the system environment)
When configuring in,
(2) configure the environment in vs ---> note that the configuration of debug and release versions is performed once (the configuration method is the same). In this way, you do not need to configure the configuration when switching later.
Correct Configuration:
Included Directory: $ (ace_root)
Included Library: $ (ace_root) \ Lib
Incorrect configuration: Do not confuse $ with %.
Directory: % ace_root
Included Library: % ace_root % \ Lib
Note: Hello world for windows! There is a fundamental difference. This is written using a cross-platform library.
The Code is as follows:
// Login. cpp: defines the entry point of the console application. // # Include "stdafx. H"
# Ifdef _ debug # pragma comment (Lib, "aced. lib") # else # pragma comment (Lib, "Ace. lib") # endif
# Include "ACE/OS _main.h" # include "ACE/service_config.h"
Int ace_tmain (INT argc, ace_tchar * argv []) {ace_ OS: printf ("Hello world! \ N "); Return 0 ;}
Note 1: This article describes the basics, such as how to install, compile the built-in ace code, and how to write a hello World! First, let's get to know it in step 1.
From: http://hi.baidu.com/vc_net/item/701874a761b2cddb5af19147