Installation as a C++ novice #134
Replies: 2 comments 5 replies
-
Those errors happen because you are compiling as C++14 or lower, and matplot++ requires C++17. This is the sort of thing CMake takes care of (or at least explicitly tells you if you are missing this). In any case, your nonstandard installation is not going to work because matplot++ is not a header-only library. Even if you somehow manage to get things to compile you will have link errors, and fixing those means you might as well rewrite the entire build system. I think it would be much more useful for everyone if you explained what you have tried with setting up CMake and what failed. |
Beta Was this translation helpful? Give feedback.
-
Hi @Zengit123 , thank you for your feedback! I think the problem here is with the assumption that
That would be the case if matplotplusplus were a header-only library, but it's not. Matplotplusplus is a library you need to compile, so this won't work either
I understand how the way C++ works might be confusing especially when you come from another language. For instance, when you say
it seems like you are assuming the files are only being included or amalgamated as if they were header-only, and you could bypass the building system. It seems like the assumption here is that all the building system does is amalgamate and include these files. The building system is actually doing a lot more than that under the hood. The build system would identify your system, your compiler, download or identify the appropriate dependencies, set compile-time definitions, ... So doing all of that without the help of CMake is not very simple at all. One possibility you can consider is a package manager, but the problem here is that most libraries just won't be there. If I'm not wrong, Conan is the largest package manager but it has less than a thousand packages, while C++ has been around for more than 40 years. I'm still thinking of an easier solution for this problem, especially considering programmers coming from other languages, because my main goal here to make C++ simpler for scientific computing and a lot of people are coming from python or even matlab. This solution would be something like npm/pip for C++. I've already done some of the work for a pre-release version, but that's not something so simple to achieve in C++, because you can't just amalgamate the source files (for a number of reasons, including the influence of different build systems in the process), and this tool would need to actually resolve the dependency conflicts (unlike npm, that duplicates conflicting dependencies). For now, the only thing I can recommend is to not bypass the "integration" section in the documentation. It's unfortunately not as simple as npm/pip/... but it's much more convenient than bypassing the build system, especially if you don't have a lot of experience with that yet. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
error.txt
Greetings!
Before I say anything, do realize I have no experience with C++ projects. As far as I can tell, matplotplusplus offers a collection of files you can call with
#include <matplot/matplot.h
in any other file you want to compile.
Considering the guide on README.md, and the fact I have never used CMake, after about an hour of trying to get the library working I have failed.
Being a Linux user and C++ noob, I put the whole "matplot" directory into my /usr/include directory, hoping that upon including it into any other C++ code it would work just fine. My logic is that there is no point in pre-compiling any files if they will be the includes of another file that will be compiled. As far as I have researched, CMake is a tool to make life easier for those who want to compile a project consisting of many C or C++ files, so I guessed I dont have to do it.
Upon compiling my code with g++ :
I get a lot of similar errors that a function is not a member of 'std'.
/usr/include/matplot/util/concepts.h:66:40: error: ‘is_same_v’ is not a member of ‘std’; did you mean ‘is_same’?
All other errors probably come as side-symptoms to this problem. I suppose I do not understand namespaces well enough.
Any type of advice is greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions