0

I use -nostdinc++ as an argument to g++ in order to use my implementation of the std library, but I would like to include first my include path and then the standard library.

For example if the vector library is missing from my implementation then I would like the compiler to search in the std lib location.

How can I do this?

yonutix
  • 1,964
  • 1
  • 22
  • 51
  • This is not possible in standard C++. You will have to use extensions such as [weak linkage](https://stackoverflow.com/questions/274753/how-to-make-weak-linking-work-with-gcc). Maybe you can find something that does "strong linkage" so it takes precedence over the standard library. – nwp Dec 12 '17 at 17:09
  • 1
    Just define your implementation in different namespace. – user7860670 Dec 12 '17 at 17:47

2 Answers2

0

You can't. If you want to use something like std::vector then you need to include the standard library into your build.

Justin Randall
  • 2,243
  • 2
  • 16
  • 23
-3

A good practice is usually to include only what your code uses in every file. That reduces dependencies on other headers and, on large projects, reduce compilation times and also helps finding out what depends on what.