Makefile for help-General Linux technology-Linux programming and kernel information. The following is a detailed description. The younger brother has encountered the following problems:
The main program is main. c, and function A, B, and A are called before function C. How can I write the makefile file?
I wrote:
Out: main. o A. o B. o C. o
Gcc-o out main. o A. o B. o C. o
. C. o:
Gcc-c $ <
I don't know. Is that true?
The problem is that the header file "complex. h" is called in main and A, B, and C. This is the header file of the self-compiled complex operations ~
The result displayed after running make is:
A. o: In function 'getacompule ':
A. c: (. text + 0x0): multip definition of 'geta' // getAcomplex is A function in complex. h.
Main. o: main. c: (. text + 0x0): first defined here.
.....
.....
Collect 2: ld returns 1
Make: *** [out] Error 1.
According to my understanding, he said that the getAcomplex function is repeatedly defined. However, if you delete the # include 'complex. h' in main or A, main or A cannot be compiled successfully.
Hope someone can tell me how to solve this problem ~
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