c++ - Including header from the same file on every platform -


i have file cpp-options.txt in have written every compiler option use compile c++ programs.

i have made alias g+ g++ @/path/to/cpp-options.txt $* , whenever invoked g+ prog.cpp, anywhere on computer, program compiled compiler options file.

now want add option includes header file header.h in options file. file kept on same directory cpp-options.txt file.
so, cpp-options.txt file looks -:

-wall -wextra.....
-include /path/to/header.h

now, setup works on windows perfectly, wont work on linux, absolute path options file on linux -:

/mnt/media......../absolute/path/to/header.h

so, compiler complain absence of such file on linux.
aware of 1 solution of problem, include folder in these 2 files kept in path environment variable on both operating systems , writing -:

-wall -wextra.....
-include header.h

however, dont want pollute path variables.
there other way of accomplishing ?

the best create common file cpp-options-common.txt contained the compiler options (-wall, -wextra, -std=c++14 etc), , shift -include /path/to/header.h statement cpp-options.txt file.
also, imported cpp-options-common.txt file cpp-options.txt file using @ gcc compiler directive.

my final configuration -:

cpp-options-common.txt -: ( located in windows partition )

-wall -wextra -wfatal-errors ... 

on windows -:

cpp-options.txt -:

@path/to/cpp-options-common.txt -include path/to/header.h 

linux -:

cpp-options.txt -:

@/media/data/path/to/cpp-options-common.txt -include /media/data/path/to/header.h 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -