Giter Site home page Giter Site logo

Comments (12)

lacc97 avatar lacc97 commented on May 19, 2024

GCC7 is too old and doesn't have full support for std::filesystem. You will have to update to GCC8.

from matplotplusplus.

alandefreitas avatar alandefreitas commented on May 19, 2024

I tried to improve the documentation a little but there's not much we can do.

from matplotplusplus.

martiege avatar martiege commented on May 19, 2024

Ah I see, sorry I thought gcc 7.5.0 could use c++17, and therefore also std::filsystem. Thank you!

from matplotplusplus.

kurogane1031 avatar kurogane1031 commented on May 19, 2024

Sorry for commenting on closed thread.
For people who using has gcc 7.5.0 built in or olders (For example like Ubuntu 18.04 comes with 7.5.0), you need to first switch your compiler using update alternatives. (Do not overwrite or directly linked it to new compiler)
This is because, for whatever reason, despite using env CXX=g++-10 cmake .. during configuration, it will select whatever current g++ version for compilation. To check your current version, just type g++ --version.

To be able to compile, just do as follows

sudo apt install build-essential

Then install whatever new version, for example if you want to install g++-10, then you need to do as follows

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt install g++-10

Then link the g++/gcc to update alternatives

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 7
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 7
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10

Once above is completed, then you can freely change your version as follows

update-alternatives --config g++

then select which g++ version you would like to use. The same goes to gcc.

update-alternatives --config g++

Before do cmake, make sure to delete the previous cmake generated files.

After that, you can run cmake .. <options> -DCMAKE_BUILD_TYPE=Release.

But in case std::filesystem is still not found, (I found in my case, most of the time things will work by deleting previous cmake generated files, e.g.: running rm -rf * in build folder), then run
env CC=gcc-10 CXX=g++-10 cmake .. <options> -DCMAKE_BUILD_TYPE=Release

Hope this helps. It works in my case, so in case it also works for yours, please do give a thumbs up.

from matplotplusplus.

alandefreitas avatar alandefreitas commented on May 19, 2024

Hi @kurogane1031,

Thanks for making this summary. I'll try to move some of that to the README when I have some time.

from matplotplusplus.

finnBsch avatar finnBsch commented on May 19, 2024

I'm on gcc9 and still have this error. Any Idea?

from matplotplusplus.

alandefreitas avatar alandefreitas commented on May 19, 2024

On GCC9 and still Cannot run simple program using std::filesystem? Or is it some other error now?
If you're getting Cannot run simple program using std::filesystem with GCC9, you're probably not using GCC9 or its standard library in your project.

from matplotplusplus.

finnBsch avatar finnBsch commented on May 19, 2024

Yes. How can i find out? I am using clion on windows with mingw. Running gcc --version still says gcc9. When I tried gcc 10 I get a different error (/wd4305 no such file or directory and /uff-8 no such file or directory). Happens only when I try to use marplot++, without it everything compiles fine.

from matplotplusplus.

alandefreitas avatar alandefreitas commented on May 19, 2024

I though it was GCC9 on linux. I didn't know it was minnow on windows. That's an important detail.

We don't test continuous integration with mingw+windows. We usually only test macOS+clang, linux+gcc, and windows+msvc. On windows, I would just recommend using visual studio. CLion can directly use visual studio now.

On windows+mingw, the error Cannot run simple program using std::filesystem means the standard library doesn't have the filesystem library, which is a C++17 library. The /wd4305 no such file or directory and /uff-8 no such file or directory errors mean the build system is trying to apply the necessary MSVC options (because it's windows) but it can't because you're using mingw. The build script would need new flags and conditions to learn to differentiate windows+msvc from windows+mingw.

That's not to say it's impossible to use matplot++ with windows+mingw, but you would need to take care of these details yourself, because there are only so many combinations we can continually test in our workflows. When the compiler and its dependencies are not available, the most we can do is improve the error messages.

from matplotplusplus.

lukac avatar lukac commented on May 19, 2024

I am getting the exact same error on windows+msvc, using latest MSVS 2022.

from matplotplusplus.

inn0minatus avatar inn0minatus commented on May 19, 2024

Same error here, Cannot run simple program using std::filesystem.
Linux, gcc, CMAKE_CXX_COMPILER_VERSION: 12.2.1
Adding lib using CPMAddPackage("gh:alandefreitas/[email protected]")

from matplotplusplus.

BrainSlayer avatar BrainSlayer commented on May 19, 2024

same error here. gcc 12.3.0

from matplotplusplus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.