Closed Arama0517 closed 9 months ago
Bot detected the issue body's language is not English, translate it automatically.
Title: windows.h cannot be found when compiling with mingw-w64 under the ubuntu system of wsl2
/usr/bin/x86_64-w64-mingw32-g++ -c -m64 -g -O0 -std=c++17 -DDEBUG -DCURL_STATICLIB -isystem /home/arama/.xmake/packages/n/nlohmann_json/v3.11.3/1db32ac108d247869096721ae8de2af8/include -isystem /home/arama/.xmake/packages/l/libcurl/8.5.0/163eaa5f8b154ae5ba76527c2a1cc01a/include -isystem /home/arama/.xmake/packages/o/openssl3/3.0.7/c1728da28e14488599c1f1d5fc92d7b5/include -o build/.objs/lib/mingw/x86_64/debug/lib/controllers/serverController.cpp.obj lib/controllers/serverController.cpp
自己对下 flags ,如果没啥问题,那就是你的 mingw 环境问题,或者是 Windows.h 大小写问题。。
反正这个跟 xmake 关系应该不大,你可以自己直接调原始编译命令
Bot detected the issue body's language is not English, translate it automatically.
/usr/bin/x86_64-w64-mingw32-g++ -c -m64 -g -O0 -std=c++17 -DDEBUG -DCURL_STATICLIB -isystem /home/arama/.xmake/packages/n/nlohmann_json/v3. 11.3/1db32ac108d247869096721ae8de2af8/include -isystem /home/arama/.xmake/packages/l/libcurl/8.5.0/163eaa5f8b154ae5ba76527c2a1cc01a/include -isystem /home/arama/.xmake/packages/o/openssl3/3.0. 7/c1728da28e14488599c1f1d5fc92d7b5/ include -o build/.objs/lib/mingw/x86_64/debug/lib/controllers/serverController.cpp.obj lib/controllers/serverController.cpp
Check flags yourself. If there is no problem, then it is a problem with your mingw environment, or a case problem with Windows.h. .
Anyway, this has nothing to do with xmake. You can directly adjust the original compilation command yourself.
Xmake 版本
2.8.6+20240115
操作系统版本和架构
Linux localhost 5.15.133.1-microsoft-standard-WSL2 #1 SMP Thu Oct 5 21:02:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
描述问题
xmake找不到mingw-w64的windows.h但usr/x86_64-w64-mingw32/include下是存在的
期待的结果
正常使用
工程配置
`add_rules("mode.debug", "mode.releasedbg", "mode.release")
add_languages("cxx17", "c17")
add_requires( "libcurl", "openssl3", "nlohmann_json" )
add_packages("nlohmann_json")
target("lib") if is_mode("debug", "releasedbg") then set_kind("shared") if is_plat("windows") then add_rules("utils.symbols.export_all", {export_classes = true}) end else set_kind("static") set_policy("build.merge_archive", true) end add_headerfiles("lib/*.hpp") add_files("lib/**.cpp") add_packages("libcurl") add_packages("openssl3") target_end()
if is_mode("debug", "releasedbg") then target("test") set_kind("binary") add_files("test.cpp") add_deps("lib") target_end() add_defines("DEBUG") end
target("main") set_kind("binary") add_files("main.cpp") add_deps("lib") target_end()`
附加信息和错误日志
`checking for mingw directory ... /usr checkinfo: cannot runv(unzip -v), No such file or directory checking for unzip ... no checking for 7z ... /usr/bin/7z checking for git ... /usr/bin/git checking for gzip ... /usr/bin/gzip checking for tar ... /usr/bin/tar /usr/bin/git rev-parse HEAD checking for cmake ... no finding libcurl from xmake .. checking for xmake::libcurl ... libcurl 8.5.0 finding openssl3 from xmake .. checking for xmake::openssl3 ... openssl3 3.0.7 finding nlohmann_json from xmake .. checking for xmake::nlohmann_json ... nlohmann_json v3.11.3 checking for x86_64-w64-mingw32-g++ ... /usr/bin/x86_64-w64-mingw32-g++ checking for the c++ compiler (cxx) ... x86_64-w64-mingw32-g++ checking for the c++ compiler (cxx) ... x86_64-w64-mingw32-g++ checking for the c++ compiler (cxx) ... x86_64-w64-mingw32-g++ checking for the c++ compiler (cxx) ... x86_64-w64-mingw32-g++ checking for the c++ compiler (cxx) ... x86_64-w64-mingw32-g++ checking for the c++ compiler (cxx) ... x86_64-w64-mingw32-g++ checking for the c++ compiler (cxx) ... x86_64-w64-mingw32-g++ checking for the c++ compiler (cxx) ... x86_64-w64-mingw32-g++ checking for the c++ compiler (cxx) ... x86_64-w64-mingw32-g++ checking for the c++ compiler (cxx) ... x86_64-w64-mingw32-g++ checking for /usr/bin/x86_64-w64-mingw32-g++ ... ok checking for flags (-fvisibility-inlines-hidden) ... ok
stack traceback: [C]: in function 'error' @programdir/core/base/os.lua:949: in function 'base/os.raiselevel' (...tail calls...) @programdir/core/main.lua:314: in upvalue 'cotask' @programdir/core/base/scheduler.lua:404: in function <@programdir/core/base/scheduler.lua:397>