Ace construction (VC ++ 6.0 environment)

Source: Internet
Author: User
Tags gz file unpack uncompress
Ace construction in Windows (VC ++ 6.0 environment) 1. extract ace-5.5.zip to the required installation directory. E:/is used as an example to decompress the package to form the ace_wrappers folder. Therefore, Ace is stored in the ace_wrappers/ace directory. Ace_root = E:/ace_wrappers. 2. Create an ace_root environment variable in the system and set it to E:/ace_wrappers. Specific settings: My computer-> properties-> advanced-> environment variables-> New 3. in the E:/ace_wrappers/ace directory, create a header file named config. h, the content is: # include "ACE/config-win32.h" (required) # define ace_has_standard_cpp_library 1 (Standard C ++ header file included in msvc) # define ace_has_mfc 1 (used with MFC) # define ace_no_inline (cancel function inline to reduce the size of static library and runtime code) # define ace_as_static_libs (build static version of ACE) # define ace_has_winnt4 0 (required for building on Windows 9x/Me, remove some special winnt/Win2k code in ACE) you only need to add the first two items. 4. load the ACE project file (ace_root/ACE/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 both ACE-Win32 debug and ACE-Win32 release, and rebuild all. As shown in: the above method may only compile the ace. dll and Ace. Lib library files. The specific reason is unknown. Compile as follows to generate all the library files. Specific Operation Method: Build-> set Active configuration... Select the ACE-Win32 release for compilation. As shown in, ace_static.dsw compilation is also enabled to generate aces. Lib, acesd. Lib, ace_rmcasts.lib, ace_rmcastsd.lib, tmcasts. Lib, and tmcastsd. Lib 5. Configure the ace environment. Open VC ++ 6.0 and choose tools> Options> directories to add the following content: 1) Executable File: e:/ace_wrappers/bin 2) include file: e:/ace_wrappers 3) library files: e:/ace_wrappers/lib 4) source files: e:/ace_wrappers: c/C ++ tab: Code Generation: select the multi-threaded Runtime Library (multithreaded DLL ). Preprocessor: add $ ace_root to the "Additional include directories" domain. Link tab: input: contains the appropriate ace library file in the "Object/library modules" field and contains the path of the ACE Library Link file in the "additional library path" field. This is usually ace_root/ace. Among them, DLL debug corresponds to aced. lib DLL release corresponds to ace. lib static library debug corresponds to acesd. lib static library release corresponds to aces. lib mfc dll debug corresponds to acemfcd. lib mfc dll release corresponds to acemfc. lib mainly uses the above two libraries. 6. Add E:/ace_wrappers/bin to the PATH variable of the system environment. Otherwise, you may encounter the issue of searching for Ace. dll or aced. dll when running the program. 7. when using the MFC program, you should add wsdata; Word verrequested = makeword (2, 2); wsastarup (verrequested, & wsdata) in initinstance (). Note: you can add the following code to the header file without manually adding the Lib library file # ifdef _ debug # pragma comment (Lib, "aced. lib ") # else # pragma comment (Lib," Ace. lib ") # endif 8. an error may occur when release is in Windows. The error is as follows: Error c2039: 'tryentercriticalsection ': is not a member of ''global error c2065: 'tryentercriticalsection': Undeclared ide Ntifier solution: Project project --> setting --> C/C ++ write: _ win32_winnt = 0x0500 ace construction in Linux 1. set the environment variable ace_root. The command is as follows: "VI/etc/profile", in "Export path user ...." Then add four lines of ace_root =/opt/ace export ace_root LD_LIBRARY_PATH = $ ace_root/aceld_library_path export LD_LIBRARY_PATH and run/etc/profile once. command: "chmod 555/etc/profile", "/etc/profile ". In this way, we have set ace_root. You can run the following command to check whether ace_root is set: "Echo $ ace_root". At this time, we 'd better restart Linux by reboot. 2. uncompress the ace.tar.gz package: Do not manually unpack the ace.tar.gz package. Do not uncompress it completely. You can see that the installation script will uncompress it for us. If you uncompress all manually, the installation script will delete your unzipped directory! The only thing we want to do is to separate the ACE-install.sh installation script in the ace.tar.gz package and modify it. We only need this file. Use mkdir to create a directory, such as/home/My/ace. then, put your ace.tar.gz in this directory (use the CP command to copy or move the MV command to this directory ). Note that this directory will be your directory storing ace.tar.gz. The installation script will come to this directory to find this file. This directory is different from ace_root, and Ace-install. sh also prompts you not to set these two directories to the same directory. Ace_root will be our installation target directory. 3. Extract A single file ACE-install.sh from ace.tar.gz, the command is as follows: "Tar-zxvf ace?tao=ciao.tar.gz ace_wrappers/ACE-install.sh" after the solution, will come out a new subdirectory "ace_wrappers ". At this point you can first move the ACE-install.sh to the external Directory: "mV/ace_wrappers/ACE-install.sh." "." represents the current directory. Of course, ACE-install.sh in what path is no impact, because we want to modify the content of the ACE-install.sh, there are a lot of paths to modify. Now in/home/My/ace there is a ACE-install.sh, we now use VI to modify it, you can back up a first before modification. Command: CP ACE-install.sh ACE-install.sh.bak, VI ACE-install.sh first find my_acedir =$ {home}/aceconfig ", change it to "my_acedir =/home/My/ace”, and then change it to the directory where the ace.tar.gz file is saved in our tutorial. Then, remove the comment. Next, find "my_ace_config = config-sunos5.4-sunc ++-4. x. h, change it to "my_ace_config = config-Linux. h, that is, to change to the configuration file in Linux. Change "my_ace_gnu_macros = platform_sunos5_sunc ++. GNU" to "my_ace_gnu_macros = platform_linux.gnu ". This is the GNU macro file settings for various operating system platforms. After the file is modified, save and exit ": WQ ". 4. Install ACE: At this time it should be in the/home/My/ace directory, we execute: H./ACE-install.sh this will be a long time to unpack, compile wait time. There will be no errors in this process, because the installation script will do a lot for us, such as generating config. h and generating platform_macros.gnu. We do not press the ace-install.html to say that the manual change: do not do the connection "ln-s config-sunos5-sunc ++-4. x. h config. H ", the installation script will be ready for us; (Subject: There is no file connection in windows, so you need to generate a config. h file, and then add a sentence "# include" ACE/config-win32.h "" in it "".) If an error occurs during compilation, such as ".. /apps/gperf. Edit the makefile under $ ace_root/apps and comment out the "gperf" section. This is just an example. You can skip compiling it. To emphasize that the installation with ACE-install.sh will compile ace, tests, apps and so on. Finally, libace. So, tests, and apps are generated, and many compiled files are generated. Of course, if you only download a single package such as ace.tar.gz for installation, You can manually modify the file and make it again. Because only ace compilation is required, much less work will be done, and it is acceptable to do it manually. Ace learning materials 1. ace programmer guide: Practical Design Patterns for network and system programming practical design patterns ace programmer's guide practical design patterns for network and systems programming (US) Stephen D. huston, (US) James ce Johnson, (US) Umar syyid translated by mavida China Power Press 2. c ++ network programming Volume 1: Using ace and mode to eliminate complexity C ++ network programming volume 1 mastering complexity with Ace and patterns [us] Douglas C. schmidt, Stephen D. huston/[us] Douglas C. schmidt, Stephen D. translated by Huston from chunjing to Huazhong Science Tech University Press 3. c ++ network programming, Volume 2 systematic reuse of C ++ network programming, Volume 2 systematic reuse with Ace and frameworks Douglas C. schmidt, Stephen n d. huston/author | mavida translation Electronics Industry Press 4. ace official website http://www.cs.wustl.edu /~ Schmidt/ace.html 5. mavida home page http://www.flyingdonkey.com/6. riverace http://www.riverace.com 7. gray fox http://www.huihoo.com/8. ace class library http://dev.csdn.net/article/40/40700.shtm common error 1: "cannot open include file: ACE/sock_acceptor.h: no such file or directory" solution: Project-> Settings-> C/C ++: add $ ace_root to additional include directories of Preprocessor, for example, E:/ace_wrappers Error 2: "You must link against multi-thre Aded libraries when using ACE (check your project settings) "solution: Project-> Settings-> C/C ++: Use run-time library of code generation: debug multithreaded DLL error 3: "error c2065: ace_error: Undeclared identifier" "error c2065: ace_debug: Undeclared identifier" solution: Add # include ACE/log_msg.h to the original Trojan. Error 4: "Error c4716: ace_main_ I: must return a value" solution: Add return 0 to main; error 5: "error lnk2001: unresolved External symbol _ declspec (dllimport) int _ cdecl "solution: Project-> Settings-> link-> input: Object/library modules add aced. add $ ace_root/ace to lib and additional library path, for example, E:/ace_wrappers/ACE: Error 6: Error c2039: sprintf: is not a member of ace_ OS solution: # include ACE/OS _ns_stdio.h error 7: Error c2039: strlen: is not a member of ace_ OS solution: # include ACE/OS _ns_string.h error 8: the dynamic link library aced cannot be found. DLL in the specified path Solution: Add D:/ace_wrappers/bin to the path of the system variable. Add it to the project-settings-C/C ++-Preprocessing Program definition, ace_as_static_libs example 1server after compilation generates server.exe 16 K serverd.exe 97 K servers.exe 124 K serversd.exe 669 K (servers.exe is more suitable for publishing) example 2 after client compilation, generate client.exe 16 K clientd.exe 97 K clients.exe 124 K clientsd.exe 669 K (clients.exe is more suitable for release) test clients 127.0.0.1 1919 servers 1919 if the compiler supports 64-bit, what macro definition is used to distinguish between 64-bit and 32-bit? A: # define Ver (2> 31)> 0? 64: 32) ----------------------------------------------------------- to the beginning of the brother and sister ace words

Given to the younger brother and sister of ACE, version 0.1.0 Stone Jiang 2006-11-6 lists the basic knowledge necessary for beginners of ACE and hopes to help those who are new to ace. The version number is added to welcome criticism, supplement, and revision. 1. c ++/OOP (some experts are deeply rooted in the C language background, thinking about the problem is not object-oriented, this kind of human learning Ace needs to supplement the OOP idea first) 2. design Pattern (Ace is not just a class library, but a series of related classes that work together through patterns. If you are familiar with design patterns, it will help you learn Ace) 3. framework (the framework should not be formal. Similar words can also be architecture. No matter what words are used, it should be pointed out that Ace is not just a class library, it is also a semi-finished product formed by combining modes in a collaborative class. The framework is different from the class library. The latter is usually passively called by code written by programmers, while the framework often actively calls user-Implemented interfaces, well-known Hollywood principles-Don't call me, I will call you) 4. linux (I was a beginner in Linux, but since I started programming in Linux, I found that many of the essence of ACE comes from Linux. I used to have limited understanding of ACE and I don't know why, in fact, we can find the answer in Linux. Ace is filled with the wisdom of Linux .) 5. richard Steven S. (Richard, who died early in the year, should be a mentor of Douglas. His work affects Douglas and Ace. Here we will talk about TCP/IP protocol strated. In fact, Richard's other books, like apue) 6. no more than 6. If you think so, please tell me. For more technical articles, see Shi Changquan's personal website: http://www.joyvc.cn

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.