First:
the development environment:Windows
IDE:vscode
when I use cmake build
#include "fmt/format.h"
int main(int, char **)
{
fmt::print("Hello,world!n");
}
error informations:
set(CMAKE_VERBOSE_MAKEFILE ON)
enter image description here
[main] 正在生成文件夹: c:/Users/syk/Desktop/c-c++/build
[build] 正在启动生成
[proc] 执行命令: chcp
[proc] 执行命令: D:mingw64bincmake.EXE --build c:/Users/syk/Desktop/c-c++/build --config Debug --target all -j 10 --
[build] D:mingw64bincmake.exe -SC:UserssykDesktopc-c++ -BC:UserssykDesktopc-c++build --check-build-system CMakeFilesMakefile.cmake 0
[build] D:mingw64bincmake.exe -E cmake_progress_start C:UserssykDesktopc-c++buildCMakeFiles C:UserssykDesktopc-c++build\CMakeFilesprogress.marks
[build] D:/mingw64/bin/mingw32-make.exe -f CMakeFilesMakefile2 all
[build] mingw32-make[1]: Entering directory 'C:/Users/syk/Desktop/c-c++/build'
[build] D:/mingw64/bin/mingw32-make.exe -f CMakeFilesTestVcpkg.dirbuild.make CMakeFiles/TestVcpkg.dir/depend
[build] mingw32-make[2]: Entering directory 'C:/Users/syk/Desktop/c-c++/build'
[build] D:mingw64bincmake.exe -E cmake_depends "MinGW Makefiles" C:UserssykDesktopc-c++ C:UserssykDesktopc-c++ C:UserssykDesktopc-c++build C:UserssykDesktopc-c++build C:UserssykDesktopc-c++buildCMakeFilesTestVcpkg.dirDependInfo.cmake --color=
[build] mingw32-make[2]: Leaving directory 'C:/Users/syk/Desktop/c-c++/build'
[build] D:/mingw64/bin/mingw32-make.exe -f CMakeFilesTestVcpkg.dirbuild.make CMakeFiles/TestVcpkg.dir/build
[build] mingw32-make[2]: Entering directory 'C:/Users/syk/Desktop/c-c++/build'
[build] [ 50%] Building CXX object CMakeFiles/TestVcpkg.dir/a.cpp.obj
[build] D:mingw64bing++.exe -DFMT_SHARED @CMakeFiles/TestVcpkg.dir/includes_CXX.rsp -g /utf-8 -MD -MT CMakeFiles/TestVcpkg.dir/a.cpp.obj -MF CMakeFilesTestVcpkg.dira.cpp.obj.d -o CMakeFilesTestVcpkg.dira.cpp.obj -c C:UserssykDesktopc-c++a.cpp
[build] g++.exe: warning: /utf-8: linker input file unused because linking not done
[build] g++.exe: error: /utf-8: linker input file not found: No such file or directory
[build] mingw32-make[2]: *** [CMakeFilesTestVcpkg.dirbuild.make:79: CMakeFiles/TestVcpkg.dir/a.cpp.obj] Error 1
[build] mingw32-make[2]: *** Deleting file 'CMakeFiles/TestVcpkg.dir/a.cpp.obj'
[build] mingw32-make[2]: Leaving directory 'C:/Users/syk/Desktop/c-c++/build'
[build] mingw32-make[1]: *** [CMakeFilesMakefile2:85: CMakeFiles/TestVcpkg.dir/all] Error 2
[build] mingw32-make[1]: Leaving directory 'C:/Users/syk/Desktop/c-c++/build'
[build] mingw32-make: *** [Makefile:93: all] Error 2
[proc] 命令“D:mingw64bincmake.EXE --build c:/Users/syk/Desktop/c-c++/build --config Debug --target all -j 10 --”已退出,代码为 2
[driver] 生成完毕: 00:00:01.612
[build] 生成已完成,退出代码为 2
when I use gcc 13.1.0 x86_64-w64-mingw32 the error happened
but I use visual studio kit ,it don’t have error
and I set cmd and powershell is utf-8
I found the google and stackoverflow
I found these place do not communicate the problem
user21947699 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
The output shows that you are supplying the argument /utf-8
to g++
:
D:mingw64bing++.exe -DFMT_SHARED @CMakeFiles/TestVcpkg.dir/includes_CXX.rsp -g /utf-8 -MD -MT CMakeFiles/TestVcpkg.dir/a.cpp.obj -MF CMakeFilesTestVcpkg.dira.cpp.obj.d -o CMakeFilesTestVcpkg.dira.cpp.obj -c C:UserssykDesktopc-c++a.cpp
g++
does not know that argument, so remove it.