[Top] develop good programming habits - a library folder

Original link: http://www.cnblogs.com/james1207/p/3333780.html

Today was more complex compiled and tested on linux.

I first describe the comparison fails compilation experience in the hope that action just tedious description of the action clearly.


Repeat scenario:

1.cpp ----> lib1.so

2.cpp ----> lib2.so

3.cpp ----> exe


Well, I was introduced to the project environment.

cpp file:

source / bak (this is the following: 1.cpp.bak, 2.cpp.bak, 3.cpp.bak

 

source/*.cpp

engineering:

 

 

project / bak (this is the following: Makfile1, Makfile2, Makfile3)

project/Makefile

 


Now into my tedious things:

To compile lib1.so, I do a bit of several actions:

All the Makefile in ①rm project directory

② copy from the project / bak Makfile1 in the project directory, and to Makefile.

All .cpp files under ③rm source directory

④ copied from the source / bak 1.cpp.bak in the source directory, and to 1.cpp.

Of course, if the compiler once, of course, this is not a problem. However, if you need to compile dozens of times, these extra brain power will become obstacles you find the truth. (Find the truth have been very difficult, table additional obstacles)


Fortunately, today is still relatively sober mind, it was quite over.


Afternoon, I will do so:

cpp file:

 

source/1/1.cpp

source/2/2.cpp

source/3/3.cpp

engineering:

project/1/Makefile

project/2/Makefile

project/3/Makefile


Now a lot better. right.


I am here to note the trivial things, but I think is very important.

One·

Reduce the pain when you check the bug, to focus on the cutting edge.

two·

Make your check error becomes traceable will not overwrite the previous test program.


Hinder reason you do such a thing:

One·

For example, you need additional information, such as a relative path Makefile and other issues.

two·

trouble. You may feel that both things can solve the problem, why should the introduction of new stuff. In fact, the most important thing is, you are afraid of change.



 

Reproduced in: https: //www.cnblogs.com/james1207/p/3333780.html

Guess you like

Origin blog.csdn.net/weixin_30906185/article/details/94984557