Demand:
Recently looking at <c++ Primer Plus>, the author is constantly optimizing his class, there are many different version numbers, there are a lot of test function (main function), I use ECLIPSE+CDT to write C + +. It is not possible to create a project for each of the classes. What then?
We know Gcc+makefile+gdb. Is the artifact under Linux. Make the code is quite flexible, but the level is not enough, or use the IDE to cooperate.
Here's a look at how to use Elipse+makefile to build a program flexibly.
1. First one:
2. Document description. Added the directory header and SRC. To store header files and implementation files, SRC has a makefile file below, and the resulting executable file is placed below binaries;
3. How to configure:
(1) in the properties of project, C + + build. Create a new configuration (manage config).
(2) Build settings. Must be to take the initiative to generate makefile the option to remove, the following build path to choose the path of makefile;
(3) to be able to participate in, detailed configuration. Able to participate: http://yuoveyu.blog.51cto.com/2926448/596429
4. The rest is to write the makefile file yourself, there is a classic tutorial:< with me to write makefile>. To be able to take the test, I makefile here:
CC: =g++rm: = Rm-rf ALL:USETIME0 usetime1 usetime2 usetime3 Clean: $ (RM) USETIME0 usetime1 usetime2 Usetime3 USETIME0 : usetime0.cpp$ (CC) usetime0.cpp mytime0.cpp-o. /BINARIES/USETIME0 usetime1:usetime1.cpp$ (CC) usetime1.cpp mytime1.cpp-o. /binaries/usetime1usetime2:usetime2.cpp$ (CC) usetime2.cpp mytime2.cpp-o. /binaries/usetime2usetime3:usetime3.cpp$ (CC) usetime3.cpp mytime3.cpp-o. /binaries/usetime3
5. How to use vs2012 under Windows How to compile flexibly? Now using Ifdefine to control the corresponding main function, which main function to use. Just define a macro variable in that main function. Log an issue: PCH Warning: The header stop point cannot be in a macro or #if block, #pragma once as the first sentence of the header file, you can avoid the warning problem that the article title says.
Write in the back:
1. Eclipse configuration, once wrote an Eclipse installation NS3. In fact, it's almost the same process.
2. How to learn C + +, can participate in the article: how to learn C + +: including some books and Java control Learning, you can find some open-source projects to learn. There is also a discussion topic: How to learn C + +
Eclipse flexible use of makefile to compile C + +