gpt4 book ai didi

c++ - scons ParseConfig 在 Windows 上使用 wx-config 时行为不正确

转载 作者:太空狗 更新时间:2023-10-29 23:07:03 25 4
gpt4 key购买 nike

我正在尝试使用 MinGW 在 Windows 上使用 wx-widgets 和 scons。这是我的 SConstruct 的违规行:

env.ParseConfig("wx-config --cxxflags --libs")

紧接着,打印 env['CPPPATH'] 给出:

['C:software_libwxWidgets2.8libgcc_dllmsw', 'C:software_libwxWidgets2.8include']

显然,它似乎缺少一些非常重要的斜杠。我认为这可能与 wx-config 的 windows 端口在其输出中给出反斜杠有关。

这些路径稍后会逐字传递给编译器,从而导致错误。其他一切都很好。

我该怎么做才能解决这个问题?

最佳答案

用蛮力解决了问题。编写了一个由以下内容组成的帮助程序 python 脚本:

import subprocess, sys

p = subprocess.Popen(["wx-config", "--cxxflags", "--libs"], stdout=subprocess.PIPE)
out, err = p.communicate()

san = out.replace("\\", "/")

sys.stdout.write(san)
sys.exit(0)

最后打电话

env.ParseConfig("python sanitize-wx-config.py")

在 SConscript 文件中。这解决了问题:

关于c++ - scons ParseConfig 在 Windows 上使用 wx-config 时行为不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13783151/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com