LINUX C ++ self-study note two <rookie beginner series>

zhaozj2021-02-17  71

Connect Linux C self-study notes

1. Multi-file compilation link GCC has -c parameters can be compiled without link Therefore, the program above can be compiled as follows.

G -c hello.cpp -o hello.og -c myfirst.cpp -o myfirst.og myfirst.o hello.o myfirst

Of course there is a simpler method: g hello.cpp myfirst.cpp -o myfirst.cpp

But I mainly want to know how to connect multi-file connections (a project often has hundreds of source programs, so connect to Ken

Tell is dead)

You can write the above-described compilation process to the following text file Linux is called Makefile (I don't know what to call, I hope that the insider is told)

# This can be filed in Myfirst: myfirst.o hello.o g myfirst.o hello.o myfirst

Hello.o: Hello.cpp G -c hello.cpp -o hello.o

Myfirst.O: myfirst.cpp g -c myfirst.cpp -o myfirst.o

The stock is myfirst in naming mode: make myfirst

2. Debug GDB ./ File Name The following is the possible command in the debug state (you can enter only the first character, such as: Break is abbreviated as b),

In the name of the List Break Line Number Run Continue Print variable DEL line number STEP Next Quit

I have written this article, it is not to show off, the masters don't think about it is just because I want to learn Linux program a year ago, but I have finally have a chance to have a chance. It is not difficult to learn from this week after a wheezing. I feel that Linux programming is not difficult.

It is difficult to get into getting started, so I want to take the big non-violation of the world. This may be a childish article. I hope that everyone can

Don't hide, help us with these rookies, write more articles, truly play the spirit of mutual help with each other

E-main: lih0712@163.net

转载请注明原文地址:https://www.9cbs.com/read-31189.html

New Post(0)