why is the messy setup required?

Why can't the experts make using c++ with libraries automatic the way it it is with Java with its simple import directive? After many years writing code with BASIC I am now having a go at using c++ with code::blocks and I find the setup required to use other people's code is still very very primitive. That there is an issue for a novice is reflected in the fact DevCPP had devpaks to automate the process. I still can't get SFML to work although the SDL library works but I am not sure what I did right that time.
Last edited on
Linkers for C++ are the same as for C due to compatibility reasons. They were written in the late 70's.

Furthermore, since most OS-es (Windows, Linux) are based on C , there has to be a simple way for the OS to load all the needed libraries, in order not to complicate matters at the level of the kernel. (simple for the OS, not for the library user). C linker is a really simple piece of code.

The setup for importing a library is actually not that complicated, It's just complicated for people who are beginning to use C++ (and definitively more complicated than the Java one-liner).

Java and many other languges also have the advantage that they are mostly developed by a single company, which makes sure that all the libraries easily work together. In C++, you are likely to use libraries developed by many different developers or orgranizations.

Anyway, things are moving forward even for C++. If I'm not mistaken, modules are supposed to be a part of C++17.

Last edited on
At:
https://meetingcpp.com/index.php/br/items/looking-for-c17-urbana-proposals-from-core.html

"The problem for C++ and modules is, that the from C inherited build system takes a different approach, every file is in this model its own translation unit, which is compiled without the knowledge about dependencies to other translation units, this is later resolved by the linker. This is very effective, but also lowlevel. Also, the authors point out, that this linkage model is 40 years old, and with integrating modules in C++, needs to adapted or replaced."
Last edited on
Thank you for your replies they have been very helpful in understanding the issues involved.
Looking forward to c++17, perhaps I will return to c++ when it comes out.
Topic archived. No new replies allowed.