View Single Post
Old 16 January 2022, 11:17   #1
Sim085
Registered User
 
Join Date: Apr 2009
Location: N/A
Posts: 962
One .h file for multiple .c files?

Hello,

I guess this is more a question in relation to make. At the moment I have organized a program with a header file for each source file. So if I have common.c then I have common.h.

Now, it is not a must must, but I would like to have a single header file which exposed functions are implemented in multiple source files. In CMake I would achieve this through the add_executable command.

Code:
add_executable(App main.c hello.h hello1.c hello2.c)
(in the above example hello.h defines functions which some are implemented in hello1.c and others in hello2.c. main.c only needs to include hello.h to access all the functions.)

However I cannot see how to replicate using make.

Anyone has any advice?
Sim085 is offline  
 
Page generated in 0.05009 seconds with 11 queries