Click here to Skip to main content
14,268,822 members
Rate this:
Please Sign up or sign in to vote.
See more:
I am having a file/folder structure like this
"MY" folder contain
main.c

then "My" folder contain two other folders named "source" and "header"

main.c has references to header files that are in the "header" folder.
The *.c source files (that are in the source directory) has there header files in "header" directory.

So i have written the make files like this

program: main.o CPU.o OS.o RAM.o snmputil.o UTILITY_FUNCTION.o

main.o: main.c /header/OS.h /header/snmputil.h /header/CPU.h
        gcc -o main.c

CPU.o: /source/CPU.c ../header/CPU.h
        gcc -o /source/CPU.c


OS.o: OS.c ../header/OS.h
        gcc -c /source/OS.c

UTILITY_FUNCTION.o: /source/UTILITY_FUNCTION.c ../header/UTILITY_FUNCTION.h
        gcc -c /source/UTILITY_FUNCTION.c




when i do make on the makefile i get the error

missing separator.  Stop.


Please guide
Posted

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Quote:
main.o: main.c /header/OS.h /header/snmputil.h /header/CPU.h
gcc -o main.c
Should be:
main.o: main.c header/OS.h header/snmputil.h header/CPU.h
        gcc -I header -c main.c



Quote:
CPU.o: /source/CPU.c ../header/CPU.h
gcc -o /source/CPU.c
Should be:
CPU.o: ../source/CPU.c ../header/CPU.h
        gcc -I../header -c /source/CPU.c


and so on.

Moreover, make sure you (and your editor as well) are using tabs instead of blanks, before compiling directives (i.e. before gcc).
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100