First of all, I want to note I love C++ and I'm one of those people who thinks it is easier to code in C++ than Java. Except for one tiny thing: libraries.

In Java you can simply add some jar to the build path and you're done.

In C++ you usually have to set multiple paths for the header files and the library itself. In some cases, you even have to use special build flags. I have mainly used Visual Studio, Code Blocks and no IDE at all. All 3 options do not differ much when talking about using external libraries.

I wonder why was there made no simpler alternative for this? Like having a special .zip file that has everything you need in one place so the IDE can do all the work for you setting up the build flags. Is there any technical barrier for this?

2 Answers 2


C++ was designed to improve the C language by making an easier, more automated language with support for object oriented programming. But it didn't do anything to change or improve the way C handles external libraries and header files. C++ has no module system like more modern languages - it still uses the C preprocessor and linker system. Since one of the stated goals of C++ was backwards compatibility with C code, this isn't really surprising. Any C++ module system would have to work alongside the old C header-file/linker system. The C++ standards committee simply hasn't gotten around to designing a more modern module system. (Although they are working on it, see Klaim's comment below.)

  • 8
    The last line isn't totally correct: the modules system have been in work since 2004 (first document) but implied so much work that it couldn't even be really envisaged for the last standard as there would have been a lack of implementation to support the proposal. That implementation have been in wortk (along with other drafts) to tartget the next C++ standard. It's not that it is not a priority of C++ designers, it's just one of these features you can't get wrong, have to keep retro-commpatibility (with most C code and C++11) and is insanely hard to getr right. So it takes a lot of time.
    – Klaim
    Commented Dec 8, 2012 at 17:08
  • Awesome. Thank you, Klaim, for the info. Will definitely check it out. That is very exciting :)
    – Pijusn
    Commented Dec 8, 2012 at 17:18
  • Most languages stay out of the business of standardizing linkages because the mechanism can vary between operating systems. Java's run-anywhere nature requires mandating a particular linkage and library format. There's nothing wrong with that, but it brings some overhead that may not be desirable in all cases.
    – Blrfl
    Commented Dec 8, 2012 at 17:24
  • Frankly, I'm quite frightened to read that the C++ standards committee is working at a module system for the language itself. C++ is already a huge and complex language and trying to add such a sensitive feature to it can be very risky. As noted by Karl Bielefeldt here below, this problem already found a good solution at the platform level (Linux package system) and could probably be addressed very well by most IDEs with little effort. Have a look at how the Qt Library and Qt Creator handle this issue, for example. Commented Dec 9, 2012 at 14:34
  • 1
    @AlexBottoni, I really doubt they'll come up with a standardized module system any time this century. They didn't even include concepts in C++11 because they couldn't agree on the precise implementation. A module system that works alongside the header/linker system is even more tricky, and we probably won't see it for a very long time. Commented Dec 9, 2012 at 14:42

It's not a technical barrier. On Linux, your "special zip file" is a library-dev package you install with a package manager, and setting up the include and linker flags is as simple as adding a couple lines to your configure.ac that uses pkg-config to set things up.

Pkg-config is available for Windows too, but cultural barriers have prevented its widespread adoption. Unix has a strong history of enabling portability by distributing source code, so they include the development tools for free. Windows has a strong history of encouraging only binary distribution and charging developers for tools. When you make your money selling libraries, it doesn't make sense to make it easier for third parties to provide them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.