I am using windows, and I need to compile a cpp file. I am using Cygwin to run the command sh
. I have already MinGw installed. The problem is that when I run the command, I find that Cygwin is calling the compiler of MinGw. Here is a trace of the error i get:
$ sh build_cpp.sh
mkdir: cannot create directory ‘build’: File exists
-- The CXX compiler identification is GNU 7.2.0
-- Check for working CXX compiler: /cygdrive/c/MinGW-124/MinGW-CPTR-124/bin/g++.exe
-- Check for working CXX compiler: /cygdrive/c/MinGW-124/MinGW-CPTR-124/bin/g++.exe -- broken
CMake Error at /usr/share/cmake-3.14.5/Modules/CMakeTestCXXCompiler.cmake:53 (message):
The C++ compiler
"/cygdrive/c/MinGW-124/MinGW-CPTR-124/bin/g++.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /cygdrive/c/users/user/PycharmProjects/crnn-master/src/cpp/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make.exe cmTC_71c00/fast
/usr/bin/make -f CMakeFiles/cmTC_71c00.dir/build.make CMakeFiles/cmTC_71c00.dir/build
make[1]: Entering directory '/cygdrive/c/users/user/PycharmProjects/crnn-master/src/cpp/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_71c00.dir/testCXXCompiler.cxx.o
/cygdrive/c/MinGW-124/MinGW-CPTR-124/bin/g++.exe -o CMakeFiles/cmTC_71c00.dir/testCXXCompiler.cxx.o -c /cygdrive/c/users/user/PycharmProjects/crnn-master/src/cpp/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
g++.exe: error: /cygdrive/c/users/user/PycharmProjects/crnn-master/src/cpp/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx: No such file or directory
g++.exe: fatal error: no input files
compilation terminated.
make[1]: *** [CMakeFiles/cmTC_71c00.dir/build.make:66: CMakeFiles/cmTC_71c00.dir/testCXXCompiler.cxx.o] Error 1
make[1]: Leaving directory '/cygdrive/c/users/user/PycharmProjects/crnn-master/src/cpp/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_71c00/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (PROJECT)
-- Configuring incomplete, errors occurred!
See also "/cygdrive/c/users/user/PycharmProjects/crnn-master/src/cpp/build/CMakeFiles/CMakeOutput.log".
See also "/cygdrive/c/users/user/PycharmProjects/crnn-master/src/cpp/build/CMakeFiles/CMakeError.log".
make: *** No targets specified and no makefile found. Stop.
cp: cannot stat '*.so': No such file or directory
I tried changing the variables of environment, installing devel package and changing the cache variables (CMAKE_CXX_COMPILER, CMAKE_CC_COMPILER) with the command cmake -d
. Where can I change the compiler of Cygwin so it will uses its compiler?
I might be due to your Windows path variable. If you have multiple binaries named g++ including one from mingw, you should add the correct one to your environment variable and remove the others. Also make use of the command which g++
to know which binary would be used. You can also maybe provide the full path of the right compiler as a workaround.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.