0

I'm trying to compile my linux code on windows. It blocks because of my use of std::filesystem. So I try to do a minimal example according to this post :

C++17 filesystem using nuwen MinGW on Windows 10

I use the same code :

#include <iostream>
#include <filesystem>
namespace fs = std::filesystem;
int main()
{
    std::cout << "Current path is " << fs::current_path() << '\n';
}

I use msys2. Ok, when I do g++ -std=c++17 ../main.cpp , it works well :

Current path is "C:\Users\Guillaume\Documents\dev\C++\test\filesystem\build"

But my project is definitevely too big to be use only with g++. So I use cmake and mingw32-make. But, it doesn't work and I have the same error than in the upper post. Complementary information :

g++ --version
g++.exe (Rev2, Built by MSYS2 project) 9.2.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

and

mingw32-make.exe --version
GNU Make 4.2.1
Built for x86_64-w64-mingw32
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

My question : what should I do to be able to compile my code with mingw32-make under msys2 ?

edit : the start of the error (too big for stackoverflow)

 mingw32-make.exe
[ 50%] Building CXX object CMakeFiles/filesystem.dir/main.cpp.obj
In file included from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/filesystem:37,
                 from C:\Users\Guillaume\Documents\dev\C++\test\filesystem\main.cpp:2:
C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/fs_path.h: In member function 'std::filesystem::__cxx11::path& std::filesystem::__cxx11::path::operator/=(const std::filesystem::__cxx11::path&)':
C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/fs_path.h:237:47: error: no match for 'operator!=' (operand types are 'std::filesystem::__cxx11::path' and 'std::filesystem::__cxx11::path')
    || (__p.has_root_name() && __p.root_name() != root_name()))
                               ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
In file included from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/iosfwd:40,
                 from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/ios:38,
                 from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/ostream:38,
                 from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/iostream:39,
                 from C:\Users\Guillaume\Documents\dev\C++\test\filesystem\main.cpp:1:
C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/postypes.h:221:5: note: candidate: 'template<class _StateT> bool std::operator!=(const std::fpos<_StateT>&, const std::fpos<_StateT>&)'
     operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
     ^~~~~~~~
C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/postypes.h:221:5: note:   template argument deduction/substitution failed:
In file included from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/filesystem:37,
                 from C:\Users\Guillaume\Documents\dev\C++\test\filesystem\main.cpp:2:
C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/fs_path.h:237:60: note:   'std::filesystem::__cxx11::path' is not derived from 'const std::fpos<_StateT>'
    || (__p.has_root_name() && __p.root_name() != root_name()))
                                                            ^
In file included from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_algobase.h:64,
                 from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/char_traits.h:39,
                 from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/ios:40,
                 from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/ostream:38,
                 from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/iostream:39,
                 from C:\Users\Guillaume\Documents\dev\C++\test\filesystem\main.cpp:1:
C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_pair.h:456:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator!=(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)'
     operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
     ^~~~~~~~
C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_pair.h:456:5: note:   template argument deduction/substitution failed:
In file included from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/filesystem:37,
                 from C:\Users\Guillaume\Documents\dev\C++\test\filesystem\main.cpp:2:
C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/fs_path.h:237:60: note:   'std::filesystem::__cxx11::path' is not derived from 'const std::pair<_T1, _T2>'
    || (__p.has_root_name() && __p.root_name() != root_name()))
                                                            ^
In file included from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_algobase.h:67,
                 from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/char_traits.h:39,
                 from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/ios:40,
                 from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/ostream:38,
                 from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/iostream:39,
                 from C:\Users\Guillaume\Documents\dev\C++\test\filesystem\main.cpp:1:
C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_iterator.h:311:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)'
     operator!=(const reverse_iterator<_Iterator>& __x,
     ^~~~~~~~
C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_iterator.h:311:5: note:   template argument deduction/substitution failed:
In file included from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/filesystem:37,
                 from C:\Users\Guillaume\Documents\dev\C++\test\filesystem\main.cpp:2:
C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/fs_path.h:237:60: note:   'std::filesystem::__cxx11::path' is not derived from 'const std::reverse_iterator<_Iterator>'
    || (__p.has_root_name() && __p.root_name() != root_name()))
                                                            ^
In file included from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_algobase.h:67,
                 from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/char_traits.h:39,
                 from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/ios:40,
                 from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/ostream:38,
                 from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/iostream:39,
                 from C:\Users\Guillaume\Documents\dev\C++\test\filesystem\main.cpp:1:
C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_iterator.h:349:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)'
     operator!=(const reverse_iterator<_IteratorL>& __x,
     ^~~~~~~~
C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_iterator.h:349:5: note:   template argument deduction/substitution failed:
In file included from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/filesystem:37,
                 from C:\Users\Guillaume\Documents\dev\C++\test\filesystem\main.cpp:2:
C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/fs_path.h:237:60: note:   'std::filesystem::__cxx11::path' is not derived from 'const std::reverse_iterator<_Iterator>'
    || (__p.has_root_name() && __p.root_name() != root_name()))
                                                            ^
In file included from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_algobase.h:67,
                 from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/char_traits.h:39,
                 from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/ios:40,
                 from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/ostream:38,
                 from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/iostream:39,
                 from C:\Users\Guillaume\Documents\dev\C++\test\filesystem\main.cpp:1:
C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_iterator.h:1124:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorR>&)'
     operator!=(const move_iterator<_IteratorL>& __x,

...

 C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/fs_path.h:180:7: note:   template argument deduction/substitution failed:
C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/fs_path.h:174:5: note: candidate: 'std::filesystem::__cxx11::path::path(std::filesystem::__cxx11::path::string_type&&, std::filesystem::__cxx11::path::format)'
     path(string_type&& __source, format = auto_format)
     ^~~~
C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/fs_path.h:174:5: note:   no known conversion for argument 1 from 'std::basic_string_view<wchar_t>' to 'std::filesystem::__cxx11::path::string_type&&' {aka 'std::__cxx11::basic_string<wchar_t>&&'}
C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/fs_path.h:167:5: note: candidate: 'std::filesystem::__cxx11::path::path(std::filesystem::__cxx11::path&&)'
     path(path&& __p) noexcept
     ^~~~
C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/fs_path.h:167:5: note:   no known conversion for argument 1 from 'std::basic_string_view<wchar_t>' to 'std::filesystem::__cxx11::path&&'
C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/fs_path.h:165:5: note: candidate: 'std::filesystem::__cxx11::path::path(const std::filesystem::__cxx11::path&)'
     path(const path& __p) = default;
     ^~~~
C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/fs_path.h:165:5: note:   no known conversion for argument 1 from 'std::basic_string_view<wchar_t>' to 'const std::filesystem::__cxx11::path&'
C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/fs_path.h:163:5: note: candidate: 'std::filesystem::__cxx11::path::path()'
     path() noexcept { }
     ^~~~
C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/fs_path.h:163:5: note:   candidate expects 0 arguments, 1 provided
mingw32-make[2]: *** [CMakeFiles\filesystem.dir\build.make:62: CMakeFiles/filesystem.dir/main.cpp.obj] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:75: CMakeFiles/filesystem.dir/all] Error 2
mingw32-make: *** [Makefile:83: all] Error 2

and the CMakeLists.txt :

cmake_minimum_required(VERSION 2.8.9)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

project (filesystem)
add_executable(filesystem main.cpp)
target_link_libraries(filesystem stdc++fs )

edit 2 :

I have modified my environnement path, and put C:\tools\msys64 on the top.

I use cmake-gui, the log of the configure is :

The C compiler identification is GNU 8.1.0
The CXX compiler identification is GNU 8.1.0
Check for working C compiler: C:/ProgramData/chocolatey/bin/gcc.exe
Check for working C compiler: C:/ProgramData/chocolatey/bin/gcc.exe -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Detecting C compile features
Detecting C compile features - done
Check for working CXX compiler: C:/ProgramData/chocolatey/bin/g++.exe
Check for working CXX compiler: C:/ProgramData/chocolatey/bin/g++.exe -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
Configuring done

the log from set(CMAKE_VERBOSE_MAKEFILE ON) :

mingw32-make.exe
"C:\Program Files\CMake\bin\cmake.exe" -SC:\Users\Guillaume\Documents\dev\C++\test\filesystem -BC:\Users\Guillaume\Documents\dev\C++\test\filesystem\build --check-build-system CMakeFiles\Makefile.cmake 0
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/Guillaume/Documents/dev/C++/test/filesystem/build
"C:\Program Files\CMake\bin\cmake.exe" -E cmake_progress_start C:\Users\Guillaume\Documents\dev\C++\test\filesystem\build\CMakeFiles C:\Users\Guillaume\Documents\dev\C++\test\filesystem\build\CMakeFiles\progress.marks
C:/tools/msys64/mingw64/bin/mingw32-make -f CMakeFiles\Makefile2 all
mingw32-make[1]: Entering directory 'C:/Users/Guillaume/Documents/dev/C++/test/filesystem/build'
C:/tools/msys64/mingw64/bin/mingw32-make -f CMakeFiles\filesystem.dir\build.make CMakeFiles/filesystem.dir/depend
mingw32-make[2]: Entering directory 'C:/Users/Guillaume/Documents/dev/C++/test/filesystem/build'
"C:\Program Files\CMake\bin\cmake.exe" -E cmake_depends "MinGW Makefiles" C:\Users\Guillaume\Documents\dev\C++\test\filesystem C:\Users\Guillaume\Documents\dev\C++\test\filesystem C:\Users\Guillaume\Documents\dev\C++\test\filesystem\build C:\Users\Guillaume\Documents\dev\C++\test\filesystem\build C:\Users\Guillaume\Documents\dev\C++\test\filesystem\build\CMakeFiles\filesystem.dir\DependInfo.cmake --color=
Scanning dependencies of target filesystem
mingw32-make[2]: Leaving directory 'C:/Users/Guillaume/Documents/dev/C++/test/filesystem/build'
C:/tools/msys64/mingw64/bin/mingw32-make -f CMakeFiles\filesystem.dir\build.make CMakeFiles/filesystem.dir/build
mingw32-make[2]: Entering directory 'C:/Users/Guillaume/Documents/dev/C++/test/filesystem/build'
[ 50%] Building CXX object CMakeFiles/filesystem.dir/main.cpp.obj
C:\ProgramData\chocolatey\bin\g++.exe    -std=c++17 -o CMakeFiles\filesystem.dir\main.cpp.obj -c C:\Users\Guillaume\Documents\dev\C++\test\filesystem\main.cpp
In file included from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/filesystem:37,
                 from C:\Users\Guillaume\Documents\dev\C++\test\filesystem\main.cpp:2:
C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/fs_path.h: In member function 'std::filesystem::__cxx11::path& std::filesystem::__cxx11::path::operator/=(const std::filesystem::__cxx11::path&)':
C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/fs_path.h:237:47: error: no match for 'operator!=' (operand types are 'std::filesystem::__cxx11::path' and 'std::filesystem::__cxx11::path')
    || (__p.has_root_name() && __p.root_name() != root_name()))

...
...

My CMAKE_CXX_COMPILER is still C:/ProgramData/chocolatey/bin/g++.exe. It's probably the problem ... but what can I do ?

Ðаn
  • 10,934
  • 11
  • 59
  • 95
Kafka
  • 720
  • 6
  • 21
  • Programming for Windows with such tools is not going to drive you far anyway. – Michael Chourdakis Jan 23 '20 at 13:12
  • @MichaelChourdakis Why not? Can you elaborate? – HolyBlackCat Jan 23 '20 at 13:29
  • [This thread](https://sourceforge.net/p/mingw-w64/bugs/737/) claims that the bug mentioned in the linked post was fixed in GCC 9. Can you post the exact error message you get, and a [mcve]? – HolyBlackCat Jan 23 '20 at 13:30
  • it seems, from the error, that mingw32-make use chocolatey gcc, while I want to use msys2 gcc (C:\tools\msys64\mingw64\bi\gcc) ... it's maybe what is wrong. But what should i do to forced mingw to use msys2 gcc ? – Kafka Jan 23 '20 at 13:47
  • @HolyBlackCat you eventually need to use tools like a good debugger, a good profiler, a good editor, intellisense, visual tools etc. And most importantly, an up to date SDK. Otherwise Windows programming is restricted to something that would not make it to production (e.g. simple console apps). Windows development is GUI related with all the bells and whistles you can (and must) have. There is absolutely no reason not to use visual studio. – Michael Chourdakis Jan 23 '20 at 13:48
  • @Kafka Make sure the msys2 gcc is in your PATH, and that it's before the chocolatey gcc. If you were building from the msys2 terminal (in `MINGW64` mode, with `make` instead of `mingw32-make`), it would've set it up automatically. – HolyBlackCat Jan 23 '20 at 13:53
  • Could you please add `set(CMAKE_VERBOSE_MAKEFILE ON)` to cmkae or build with `make VERBOSE=1` or `cmake --build -- VERBOSE=1` and post the output of the build command? Could you add full cmake output, where it configures? What cmake version do you use, `2.8.9` is old, I guess you have make 4.2.1 so cmake is probably at version 3 at least. I think with 2.8.9 the variables `CMAKE_CXX_*` are just ignored, they were introduced in 3.1, so `cmake_minimum_required(VERSION 3.1)` – KamilCuk Jan 23 '20 at 13:54
  • 1
    @MichaelChourdakis One reason not to use Visual Studio is that Microsoft doesn't provide a C++ compiler that follows the C++ standard. You can achieve the same with Qt and Qt Creator or Clion. – Thomas Sablik Jan 23 '20 at 14:02
  • @MichaelChourdakis Also MSYS2 gives you the convenience of using the exact same compiler/tools on both Windows and Linux (makes writing cross-platform code easier). – HolyBlackCat Jan 23 '20 at 14:03
  • @ThomasSablik C++ support in VS is adequately standard. Besides, no Windows developer practically cares. The toolset provided by VS is enormous and way more important than a C++ standard. – Michael Chourdakis Jan 23 '20 at 14:09
  • @HolyBlackCat so? There is no guarantee if the X tool that works in linux should work equally well in Windows (actually, it's mostly the opposite, apps made for linux are way inferior in Windows). You need native tools if you don't want to restrict yourself to so called cross platform console-only tools that noone in Windows will ever use. – Michael Chourdakis Jan 23 '20 at 14:10
  • @MichaelChourdakis With gcc/clang, Qt and Qt Creator or Clion you write one code for Win, Mac and Linux. You have the same libraries and the same environment on all systems. With Visual Studio your write only for Windows. In our team we have most developers with Linux, some with Mac and some with Windows. Visual Studio is no option. – Thomas Sablik Jan 23 '20 at 14:12
  • @ThomasSablik most users do not care. – Michael Chourdakis Jan 23 '20 at 14:13
  • 1
    @MichaelChourdakis _"There is absolutely no reason not to use visual studio."_ In our company there is such a reason and I saw multiple companies with the same reason. – Thomas Sablik Jan 23 '20 at 14:16
  • @ThomasSablik okay, no problem. I'm just discussing our experience. – Michael Chourdakis Jan 23 '20 at 14:17
  • *"My CMAKE_CXX_COMPILER is still C:/ProgramData/chocolatey/bin/g++.exe"* Did you restart cmake-gui after changing the PATH? If you did, then try specifying the full compiler path: in cmake-gui, after pressing 'Configure', select 'Specify native compilers' (or something like that). – HolyBlackCat Jan 23 '20 at 14:24
  • Ok, I had to remove chocolatey from my system environment (just stay the path in my user environment). Now, it's working ! Thank you ! – Kafka Jan 23 '20 at 14:31

1 Answers1

3

The problem comes from the version of gcc used by cmake. In order to use the correct version, I change the order of my environnement path (system->advanced systems parameters->environment variable->path) and put "C:\tools\msys64\mingw64\bin" on the top. Finally, I suppressed from my system environment the paths which can overload the path of msys2 gcc.

Hope it can help someone else.

Kafka
  • 720
  • 6
  • 21