Problem with building project in C -


I am doing a project in C and I have a problem making it happen:

I have two separate subsystems [A and B] which use the functionality of another sub-system in my project [C]. To do this, they include the header files # necessary, the obligation is that both the sub systems [A and B] should be made separately, by which I mean that I have two separate ' Makefile 'and I run different' make 'on each

Now, when I try to unite all my subsystems [A, B, C] in a single project, the GCC tells That has some function The announcements have been made from Le and these functions are related to subsystem C.

I realize that the header files are included at the time of compilation, i.e. when I use 'make' on sub systems [A and B], so when I try to unite them all I am doing it, they are actually being declared twice.

Can anyone help me with this solution? In any solution, I do not need to collect both sub systems [A and B].

OK This is either a compile error or a linky error.

If this is a compile-time error , you get something. It:

 #ifndef FILE_NAME_H # FILE_NAME_H # Define file content here #endif 

This will prevent a file from being included more than once to reflect filename Change FILE_NAME_H so that each guard is unique.

If this is a link-time error , then usually occurs when you have function bodies (i.e. {} ) in the header Because many files will contain a header, each object code will have its own definition, which will cause the linking conflict.

The best way to go around this is to make sure that you can try all the function body files and __ inline __ if they are quite low, but the compiler Do not guarantee to hear from you.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -