I have a project with multiple .h and .cpp files.
I want to compile this project and add #defines using GCC.
some of the .h files are paired with .cpp files.
some are just standalone.
each .h file has its own #define that needs to be set
how to do this ??
I am not able to understand the problem. could you elaborate ?
What exactly a #define will do ?
in my files i have multiple sections like this
i want to be able to define or undefine this FOO in compilation
each .h file has a different FOO.
now when i compile i use for example:
g++ file1.cpp file2.cpp file3.cpp -o file.o
how do i change this to alter #defines in .h files ??
this will define FOO in all .cpp files
but i need to define different FOO in each .h file
something like this
g++ -DFOO1 file1.h -DFOO2 file2.h -DFOO3 file3.h file1.cpp file2.cpp file3.cpp -o file.o
is that possible ??
Yes, you can have as many defines as you want.
and so on.