如何使用 Visual Studio 2010 构建 wxWidgets 2.9.1?
我有一个新下载的 Visual Studio C++ 2010 Express 和 wxWidgets 2.9.1。 wx\build\msw 下的 build 文件夹包含 VC++ 版本 6 到 9 (2008) 的解决方案文件。
我尝试打开最新的解决方案wx_vc9.sln。它转换了所有项目并带有一堆警告。当我尝试构建每个项目时都会出现错误:
C:\程序文件 (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(151,5): 错误 MSB6001:无效的命令行 切换为“cmd.exe”。路径不是 具有法律形式。
尝试打开解决方案的先前版本 wx_vc8.sln 会生成相同的转换警告和相同的构建错误。
我在 Google 上搜索了一些提示,并找到了从 .dsw 文件开始的建议。我打开 wx.dsw,它为每个项目文件生成一个错误:
D:\3rdParty\wx\build\msw\wx_wxregex.dsp :错误:项目升级失败。
最后在绝望中我尝试了 nmake /f makefile.vc 并遇到了另一个错误:
NMAKE:致命错误 U1077:'cl': 返回代码“0xc0000135”
有人有任何提示吗?谢谢。
I have a freshly downloaded Visual Studio C++ 2010 Express and wxWidgets 2.9.1. The build folder under wx\build\msw has solution files for VC++ versions 6 through 9 (2008).
I tried to open the latest solution, wx_vc9.sln. It converted all the projects with a bunch of warnings. When I try to build every project gets the error:
C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(151,5):
error MSB6001: Invalid command line
switch for "cmd.exe". The path is not
of a legal form.
Trying to open the previous version of the solution, wx_vc8.sln, generates the same conversion warnings and the same build errors.
I Googled for some hints and found a suggestion to start with the .dsw file. I opened wx.dsw and it generated an error for each of the project files:
D:\3rdParty\wx\build\msw\wx_wxregex.dsp
: error : Project upgrade failed.
Finally in desperation I tried nmake /f makefile.vc
and was greeted with yet another error:
NMAKE : fatal error U1077: 'cl' :
return code '0xc0000135'
Anybody have any hints? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
有两种方法可以解决这个问题,首先,如果您更新到 wxWidgets SVN trunk 的更新版本,则此问题将得到修复(因此在 2.9.2 发布时它将得到修复)。如果您不想从等待 2.9.2 的主干工作,那么如果您对所有 .vcxproj 文件进行查找和替换并替换
与
然后应该可以正常编译。
There are two ways of solving this, firstly if you update to a more recent version of the wxWidgets SVN trunk this is fixed (and so it will be fixed in 2.9.2 when it is released). If you don't want to work from trunk of wait for 2.9.2 then if you do a find and replace over all .vcxproj files and replace
with
it should then compile fine.
为了将来的参考,请相信我,避免所有废话并启动 Visual Studio 2010 命令提示符并导航到 [wxwidgets 目录]\build\msw
然后使用 makefile 和以下命令进行编译:
nmake -f makefile.vc BUILD=release MONOLITHIC=0 SHARED=0 UNICODE=1
当然,根据需要更改选项。
这样你会省去很多麻烦,我就是这么做的。
For future reference, trust me people, avoid all nonsense and start up your Visual Studio 2010 Command Prompt and navigate to [wxwidgets directory]\build\msw
Then compile using the makefile with the following command :
nmake -f makefile.vc BUILD=release MONOLITHIC=0 SHARED=0 UNICODE=1
Of course change the options as needed.
You will be saving a lot of trouble this way, this is the way I did.
使用 Visual C++ 2010 Express 和 wxWidgets 2.9.3 进行编译的关键是不断按 F7 一次又一次......直到您收到下面的“0 失败”消息。由于许多项目有不能立即满足的依赖关系,因此需要继续使用“F7”进行编译,直到所有依赖关系都满足为止。
下载 wxWidgets。我下载了 .7-Zip 文件(只有 12 MB!),并将其安装在 C:\wxWidgets 结构应该是这样的,以便您看到以下文件夹,例如 C:\wxWidgets\lib 和 C:\wxWidgets\build 等等等...
基本上,该过程应该是转到 C:\wxWidgets\build\msw ,然后打开 VC-2008 的 wx_vc9 解决方案文件,并在询问时将其转换为 VC-2010。然后选择顶部的“DLL-Release Win32”,然后按F7。等待编译发生并查看消息。然后继续按 F7 一次又一次,直到出现下面的“0 失败”消息。然后您需要以相同的方式编译“DLL-Debug”版本。
编译后的 DLL 文件可以在 C:\wxWidgets\lib\vc_dll 中找到。现在,要将 vc_dll 文件夹添加到您的路径中,请右键单击“我的电脑”->“属性->高级系统设置->环境变量 ->用户变量。搜索“路径”-> “编辑”,然后将 ;C:\wxWidgets\lib\vc_dll 添加到末尾。
这使得运行已编译的应用程序变得更加容易,因为您的 .EXE 现在可以轻松找到 DLL。
当您打包时,显然您需要捆绑特定的 Release-DLL。
然后您可以编译位于 C:\wxWidgets\samples 的示例。
我只需转到单个项目文件夹,例如 C:\wxWidgets\samples\drawing,然后打开 Drawing_vc9 项目,然后按提示将其转换,然后按 F7 创建发布版本。现在,如果您进入 C:\wxWidgets\samples\drawing\vc_mswudll\ 文件夹,您的“drawing.exe”就可以运行了!
玩得开心 !
The Key to Compilation using Visual C++ 2010 Express and wxWidgets 2.9.3 is to keep Pressing F7 Again-and-Again-and-again.... till you you get '0 Failed' Message below. Because many Projects have dependencies which are not satisfied immediately, so it is necessary to keep compiling with 'F7' till all are satisfied.
Download wxWidgets. I downloaded the .7-Zip File (only 12 MB ! ), and installed it at C:\wxWidgets The Structure should be like so that you see the following Folders like C:\wxWidgets\lib and C:\wxWidgets\build etc etc...
Basically the process should be to go to C:\wxWidgets\build\msw , and open wx_vc9 Solution File for VC-2008, and convert it to VC-2010 when asked. Then Choose 'DLL-Release Win32' on Top, and Press F7. Wait for Compilation to take place and see the Message. Then keep Pressing F7 again and again till you get '0 Failed' Message below. Then you would want to Compile 'DLL-Debug' Release in the same manner.
The compiled DLL Files can then be found at C:\wxWidgets\lib\vc_dll. Now, To Add vc_dll Folder to your PATH, Right-Click on My-Computer -> Properties -> Advanced System Settings -> Environment-Variables -> User-Variables. Search for 'Path' -> 'Edit', and then Just Append ;C:\wxWidgets\lib\vc_dll to the End.
This makes running your compiled Application easier, as your .EXE can now easily find DLLs.
When you are packaging, then you obviously need to bundle specific Release-DLL'S along.
Then you can compile the Samples located at C:\wxWidgets\samples.
I just go to individual Project Folder, like for e.g. C:\wxWidgets\samples\drawing, and Open drawing_vc9 Project, then Convert it as Prompted, and then hit F7 to create Release Version. Now if you go inside C:\wxWidgets\samples\drawing\vc_mswudll\ Folder, you have your 'drawing.exe' ready-to-be-run !
Have fun !
使用 wx.dsw,我花了一段时间才最终得到它,但之后它会构建得很好。我还建议使用示例项目之一(例如“最小”)作为基础,并修复所有配置路径以匹配您想要构建的内容(如手动设置我遇到的问题)。
如果您已经使用了wx_vc9(就像您所说的那样),您可能最好删除所有wx并重新启动它并使用wx.dsw,就像我上面所说的那样。
Use the wx.dsw, took me a while to finally get it but it'll build fine after that. I also suggest using one of the sample projects such as 'minimal' as the base and just fix all the config paths to match what you want to build (as manually setting up I encountered issues).
If you already used the wx_vc9 (like you said you did) you are probably best off just deleting all of wx and restarting with it and using wx.dsw like I said above.