tags:

views:

79

answers:

2

Hello everyone! I need to compile some files with a usage of modified versions of standard library headers. With Visual C++ compiler I will do this by usage of /X (Ignore Standard Include Paths) and /I (Additional Include Directories) parameters. How this should be done with gcc?

+8  A: 
gcc -nostdinc -I/custom/include/path/goes/here

-nostdinc ignores standard C include directories
-nostdinc++ ignores standard C++ include directories

Mehrdad Afshari
A: 

If you just add -I to your command line you will see (especially if you also add -v) that gcc will look in these folders first before looking in any other folders. So you don't need to add --nostdinc) in order to use an alternative STL library.

In this way STLPort is used:

g++ -I path-to-stlport-include main.cpp -L path-to-stlport-lib -lstlport

skwllsp
But in some cases it's better not to have standard include paths, so standard headers will not be included instead of one I'm using for replacement in case when that replacement is missing. From my POV it's much better to have compilation error in that case than confusing behavior of successfully compiled unit.
Dmitriy Matveev