tboox / tbox

🎁 A glib-like multi-platform c library
https://docs.tboox.org
Apache License 2.0
4.87k stars 723 forks source link

vs2022 tbox 1.7.5 xmake编译报错 #263

Closed edidada closed 2 months ago

edidada commented 2 months ago

注:提问题时若使用不能用/没效果/有问题/报错此类模糊表达,但又没有根据下面的模板给出任何相关辅助信息的,将绝对不会有任何反馈。

描述问题

error: log2f.c src\tbox\libm\log2f.c(45): error C2220: 以下警告被视为错误

in src\tbox\libm\log2f.c

期待的结果

xmake编译成功

错误信息

如果可能,请尽量附加程序运行过程中的错误输出信息。

相关环境

请提供编译和运行环境信息。

其他信息

请提供其他附加信息帮助我们诊断问题。

Issues-translate-bot commented 2 months ago

Bot detected the issue body's language is not English, translate it automatically.


Title: vs2022 tbox 1.7.5 xmake compilation error

Note: If you use vague expressions such as `not working/no effect/problem/error' when asking a question, but do not provide any relevant auxiliary information according to the template below, there will be absolutely no feedback.

Describe the problem

error: log2f.c src\tbox\libm\log2f.c(45): error C2220: The following warning is considered an error

in src\tbox\libm\log2f.c

Expected results

xmake compiled successfully

error message

If possible, please try to attach error output information during the running of the program.

Related environment

Please provide compilation and running environment information.

Other information

Please provide any additional information to help us diagnose the issue.

waruqi commented 2 months ago

xmake.lua 里 error 警告关了

Issues-translate-bot commented 2 months ago

Bot detected the issue body's language is not English, translate it automatically.


The error warning in xmake.lua is turned off

edidada commented 2 months ago

怎么关闭xmake.lua的警告?

add_rules("mode.debug", "mode.release")

if is_plat("windows") then
    add_cflags("/W0", {force = true})
    -- add_cxxflags("/W0", {force = true}) -- 如果是C++代码
else
    add_cflags("-w")
    -- add_cxxflags("-w") -- 如果是C++代码
end

target("your_target_name")
    set_kind("binary")
    add_files("src/*.c")

chatgpt 的回复?

waruqi commented 2 months ago

https://github.com/tboox/tbox/blob/553c32406a09e3e0a0a8e8dfed741b4888ba07ca/xmake.lua#L11