安装LIion后,新建项目后不能编译。查看了好多类似问题,确保项目所在路径,安装路径以及编译环境应该不存在中文字符。但仍无法解决。
"E:\software\CLion\CLion 2021.3.3\bin\cmake\win\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug "-DCMAKE_MAKE_PROGRAM=E:/software/CLion/CLion 2021.3.3/bin/ninja/win/ninja.exe" -G Ninja C:\Users\sddl2020\CLionProjects\untitled
-- The C compiler identification is GNU 11.2.0
-- The CXX compiler identification is GNU 11.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: E:/software/CLion/CLion 2021.3.3/bin/mingw/bin/gcc.exe
-- Check for working C compiler: E:/software/CLion/CLion 2021.3.3/bin/mingw/bin/gcc.exe - broken
CMake Error at E:/software/CLion/CLion 2021.3.3/bin/cmake/win/share/cmake-3.21/Modules/CMakeTestCCompiler.cmake:69 (message):
The C compiler
"E:/software/CLion/CLion 2021.3.3/bin/mingw/bin/gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/sddl2020/CLionProjects/untitled/cmake-build-debug/CMakeFiles/CMakeTmp
Run Build Command(s):E:/software/CLion/CLion 2021.3.3/bin/ninja/win/ninja.exe cmTC_521ae && [1/2] Building C object CMakeFiles/cmTC_521ae.dir/testCCompiler.c.obj
[2/2] Linking C executable cmTC_521ae.exe
FAILED: cmTC_521ae.exe
cmd.exe /C "cd . && "E:\software\CLion\CLion 2021.3.3\bin\mingw\bin\gcc.exe" CMakeFiles/cmTC_521ae.dir/testCCompiler.c.obj -o cmTC_521ae.exe -Wl,--out-implib,libcmTC_521ae.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib/libkernel32.a when searching for -lkernel32
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib\libkernel32.a when searching for -lkernel32
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib/libuser32.a when searching for -luser32
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib\libuser32.a when searching for -luser32
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib/libgdi32.a when searching for -lgdi32
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib\libgdi32.a when searching for -lgdi32
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib/libwinspool.a when searching for -lwinspool
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib\libwinspool.a when searching for -lwinspool
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib/libshell32.a when searching for -lshell32
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib\libshell32.a when searching for -lshell32
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib/libole32.a when searching for -lole32
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib\libole32.a when searching for -lole32
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib/liboleaut32.a when searching for -loleaut32
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib\liboleaut32.a when searching for -loleaut32
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib/libuuid.a when searching for -luuid
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib\libuuid.a when searching for -luuid
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib/libcomdlg32.a when searching for -lcomdlg32
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib\libcomdlg32.a when searching for -lcomdlg32
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib/libadvapi32.a when searching for -ladvapi32
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib\libadvapi32.a when searching for -ladvapi32
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib/libmingw32.a when searching for -lmingw32
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib\libmingw32.a when searching for -lmingw32
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib/libmoldname.a when searching for -lmoldname
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib\libmoldname.a when searching for -lmoldname
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib/libmingwex.a when searching for -lmingwex
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib\libmingwex.a when searching for -lmingwex
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib/libmsvcrt.a when searching for -lmsvcrt
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib\libmsvcrt.a when searching for -lmsvcrt
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib/libkernel32.a when searching for -lkernel32
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib\libkernel32.a when searching for -lkernel32
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib/libadvapi32.a when searching for -ladvapi32
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib\libadvapi32.a when searching for -ladvapi32
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib/libshell32.a when searching for -lshell32
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib\libshell32.a when searching for -lshell32
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib/libuser32.a when searching for -luser32
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib\libuser32.a when searching for -luser32
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib/libkernel32.a when searching for -lkernel32
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib\libkernel32.a when searching for -lkernel32
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib/libmingw32.a when searching for -lmingw32
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib\libmingw32.a when searching for -lmingw32
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib/libmoldname.a when searching for -lmoldname
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib\libmoldname.a when searching for -lmoldname
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib/libmingwex.a when searching for -lmingwex
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib\libmingwex.a when searching for -lmingwex
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib/libmsvcrt.a when searching for -lmsvcrt
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib\libmsvcrt.a when searching for -lmsvcrt
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib/libkernel32.a when searching for -lkernel32
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: skipping incompatible C:/MinGW/lib/../lib\libkernel32.a when searching for -lkernel32
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: i386 architecture of input file `C:/MinGW/lib/../lib/crt2.o' is incompatible with i386:x86-64 output
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x34): undefined reference to `_signal'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x89): undefined reference to `_signal'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0xc0): undefined reference to `_signal'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0xd9): undefined reference to `_signal'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x10b): undefined reference to `_signal'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x153): more undefined references to `_signal' follow
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x15f): undefined reference to `_fesetenv'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x17d): undefined reference to `_signal'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x199): undefined reference to `_signal'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x1b8): undefined reference to `___dyn_tls_init_callback'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x1e4): undefined reference to `_SetUnhandledExceptionFilter@4'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x1ec): undefined reference to `___cpu_features_init'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x1f1): undefined reference to `__CRT_fenv'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x1f9): undefined reference to `_fesetenv'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x203): undefined reference to `__CRT_fmode'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x20d): undefined reference to `__imp___iob'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x212): undefined reference to `__fmode'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x221): undefined reference to `__setmode'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x226): undefined reference to `__CRT_fmode'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x235): undefined reference to `__setmode'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x23a): undefined reference to `__CRT_fmode'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x249): undefined reference to `__setmode'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x24e): undefined reference to `___p__fmode'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x254): undefined reference to `__fmode'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x25b): undefined reference to `__pei386_runtime_relocator'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x263): undefined reference to `___main'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x268): undefined reference to `___p__environ'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x284): undefined reference to `_main'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x28b): undefined reference to `__cexit'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x293): undefined reference to `_ExitProcess@4'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x2c3): undefined reference to `__CRT_glob'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x2d7): undefined reference to `___getmainargs'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x2ec): undefined reference to `__imp____set_app_type'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x30c): undefined reference to `__imp____set_app_type'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x322): undefined reference to `__imp__atexit'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: C:/MinGW/lib/../lib/crt2.o:(.text+0x332): undefined reference to `__imp___onexit'
E:\software\CLion\CLion 2021.3.3\bin\mingw\bin/ld.exe: ertr000001.o:(.rdata+0x0): undefined reference to `_pei386_runtime_relocator'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!
See also "C:/Users/sddl2020/CLionProjects/untitled/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "C:/Users/sddl2020/CLionProjects/untitled/cmake-build-debug/CMakeFiles/CMakeError.log".
[Finished]
已经确保没有中文路径了,仍无法解决。
不知道如何解决!
安装gcc/g++
注意“E:/software/CLion/CLion 2021.3.3/bin/mingw/bin/gcc.exe”中包含空格,不推荐。
应改为比如“E:/mingw/bin/gcc.exe”
程序员的常识之一:不要将程序源代码或项目或exe放在桌面这种复杂(多半带空格和汉字且在防火墙或杀毒软件严密控制的C盘上)的目录下。
重新修改了编译器的路径就可以了。