Search code examples
c++flutterdartcmakedesktop-application

CMake Error while running Flutter desktop application in Linux


I'm trying to run Flutter desktop application and i'm getting this error :

CMake Error at /usr/share/cmake-3.22/Modules/CMakeTestCXXCompiler.cmake:62 (message): The C++ compiler

    "/usr/bin/clang++"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/dv/Documents/tst_pr/build/linux/x64/debug/CMakeFiles/CMakeTmp

    Run Build Command(s):/usr/bin/ninja cmTC_15a4f && [1/2] Building CXX object CMakeFiles/cmTC_15a4f.dir/testCXXCompiler.cxx.o
    [2/2] Linking CXX executable cmTC_15a4f
    FAILED: cmTC_15a4f 
    : && /usr/bin/clang++   CMakeFiles/cmTC_15a4f.dir/testCXXCompiler.cxx.o -o cmTC_15a4f   && :
    /usr/bin/ld: cannot find -lstdc++: No such file or directory
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    ninja: build stopped: subcommand failed.





  CMake will not be able to correctly generate this project. Call Stack (most recent call first):   CMakeLists.txt:3 (project)


Building Linux application...                                          Exception: Unable to generate build files

i tried looking for a solution to this issue but no idea yet.


Solution

  • I don't know exactly what led to this issue since it was working fine before but here the solution i tried (coppied this one from another solution, check Tsyvarev comment under my Question):

    I installed this : sudo apt install libstdc++-12-dev

    and then : flutter clean

    finally : flutter run.

    and here we go, now its working.