成功构建 wxWidgets 后下一步做什么:Visual Studio 2010

发布于 2024-12-24 02:29:04 字数 373 浏览 2 评论 0原文

我已经下载了 C++ 开源应用程序,该应用程序是在 Linux IDE/编辑器(或者可能是非 Windows)下创建的,并且不再受支持。

这次我想使用 VS 2010 编辑并重新编译它

。留下错误(大多以“wx”为前缀),例如:

  • “wxString 未定义”
  • “wxStaticText 需要类型说明符”

等...让我认为这都是关于 wxWidgets 的。

成功构建 wxWidgets 后,下一步该怎么做才能将其集成到实际的 C++ 程序中,以便我能够使用 VS 2010 进行编辑和编译?

我两年前使用 BorlandC++,但不熟悉 GUI 包。

I have downloaded c++ open source application which was created using under Linux IDE/Editor (or maybe something NOT Windows) and its no longer supported.

This time I want to edit and recompile it using VS 2010.

Error(s) left (mostly prefixed with "wx") such as:

  • "wxString is undefined"
  • "wxStaticText expected a type specifier"

etc... makes me think that this is all about wxWidgets.

After successfully building wxWidgets, what to do next to integrate it to the actual c++ program for me to be able to edit and compile using VS 2010?

I use BorlandC++ last 2 years ago but not familiar with GUI packages.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

久光 2024-12-31 02:29:04

第一步是告诉编译器在哪里查找 wxWidgets 包含文件。

因此,您需要找出这些文件在哪里,这取决于您安装和构建 wxWidgets 的位置。

在我的系统上,这是 C:\Program Files (x86)\wxWidgets-2.8.12

我认为最好的方法是创建一个环境变量 WXROOT 来存储您的路径,而不是在每个项目中硬编码路径。 wxWidgets 文件夹。

控制面板|系统|高级|环境变量

现在您必须告诉编译器有关此

Visual Studio | 的 信息。项目|属性 | C/C++ |其他包含目录

您在此处添加的内容取决于您正在执行的构建类型。如果您正在进行 unicode 发布版本,那么这将是一个好的开始

"$(WXROOT)\lib\vc_lib\mswu";"$(WXROOT)\include"

现在您应该已经修复了编译器错误。

接下来你会得到一些链接器错误......

The first step is to tell the compiler where to look for the wxWidgets include files.

So, you need to find out where these files are, which depends on where you installed and built wxWidgets.

On my system, this is C:\Program Files (x86)\wxWidgets-2.8.12

I consider the best way is to, instead of hard-coding the path in every project, create an environment variable WXROOT to store the path to your wxWidgets folder.

Control Panel | System | Advanced | Environment variables

Now you have to tell the compiler about this

Visual Studio | Project | Properties | C/C++ | Additional Include Directories

What you add here depends on what kind of build you are doing. If you are doing a unicode release build, then this will be a good start

"$(WXROOT)\lib\vc_lib\mswu";"$(WXROOT)\include"

Now you should have fixed your compiler errors.

Next you will get some linker errors ....

云朵有点甜 2024-12-31 02:29:04

也许这些错误是因为您使用的是 VS 2010 中不支持的 wxwidget 2.8 引起的。

尝试构建 wxwidgets 2.9 或使用 VS 2008。我在 VS 2010 上构建 wxwidgets 2.9 没有问题。Wxwidgets

站点主页说“虽然这仍然是正式的开发”由于部分API细节尚未冻结,我们相信2.9.3可以发布用于生产环境”。

关于成功构建后该怎么做,请看一下这个 http://wiki.wxwidgets.org /Microsoft_Visual_C%2B%2B_Guide

您可能需要使用“从示例创建新项目”部分的教程,因为手动创建项目有点困难有点复杂,因为 wxwidgets 需要一些额外的配置,而不仅仅是像大多数库那样设置和包含库目录。

Maybe the errors are caused because you are using wxwidget 2.8 which is unsupported in VS 2010.

Try building wxwidgets 2.9 or use VS 2008. I had no problem building wxwidgets 2.9 on VS 2010.

Wxwidgets site home says "While this is still officially a development release because some API details are still not frozen, we believe that 2.9.3 can be used in production environment".

About what to do after successfully build it, take a look at this http://wiki.wxwidgets.org/Microsoft_Visual_C%2B%2B_Guide

You may want to use the tutorial of the section "Creating a new project from a sample" 'cause creating a project by hand is a little bit complicated as wxwidgets requires some extra configuration and not just to set and include and libs dir as most of the libs does.

So要识趣 2024-12-31 02:29:04

这是一个视频,展示了如何开始使用 Visual Studio。
您还可以查看 samples 目录,并根据该目录中的项目配置创建您自己的项目。

Here is a video which shows how to start with Visual Studio.
Also you can take a look at samples directory and create your own project based on configuration of projects from that directory.

此岸叶落 2024-12-31 02:29:04

可能我有点晚了,但这会对 wxwidgets 的新手有所帮助。

首先转到 Wxwidgets 目录(下载路径),在我的例子中它是“C:\Users\WxWidgets_all”。
现在在该文件夹中转到构建目录。现在打开 Visual Studio 命令提示符。如果您已经安装了 Visual Studio,那么您可以通过开始菜单轻松找到它。
现在在命令提示符下转到 /build/msw/ 。现在运行以下命令。

nmake /f makefile.vc--静态库和调试版本
nmake /f makefile.vc SHARED=1--对于共享库和调试版本
nmake /f makefile.vc BUILD=release--对于共享库和发布版本

完成后,您将在“\lib\” 取决于上述命令中提供的选项。

现在将与wxwidgets相关的所有文件包含在您的项目中。主要需要两个路径来包含“\inlcude\”和“\lib\” vc_”。

之后,将 wxwidgets 生成的库链接到您的项目。为此,请在库部分中将“\lib\vc_”添加到您的项目属性中。

现在将以下预处理器添加到您的项目中。

_WINDOWS
NDEBUG(待发布)
_DEBUG(用于调试)
_CRT_SECURE_NO_DEPRECATE=1
_CRT_NON_CONFORMING_SWPRINTFS=1
_SCL_SECURE_NO_WARNINGS=1
__WXMSW__
_UNICODE

之后,将以下库添加到您的项目中:“\lib\vc_

wxbase30u_net< br>
wxmsw30u_core
wxbase30u
wxtiff
wxjpeg
wxpng
wxzlib
wxregexu
wxexpat
wxmsw30u_adv

根据您的编译选项,库名称可能略有不同。

我想我已经介绍了运行 wxWidgets 的所有步骤。

即使出现错误,您也可以检查“\samples”中的minimal项目
目录。尝试运行该项目,即使出现错误,也表明您的 wxwidgets 未正确构建。

希望这会有所帮助。

May be I am little bit late , But this will help newcomers to wxwidgets.

First of all Goto Wxwidgets directory(to download path) in my case it is "C:\Users\WxWidgets_all".
Now in that folder goto build directory.Now open Visual Studio Command prompt. If you have already installed Visual Studio then you can easily find it through start menu.
Now in command prompt go upto <Path to your wxWidgets>/build/msw/ . Now run Following Commands.

nmake /f makefile.vc--For Static Library and Debug Version
nmake /f makefile.vc SHARED=1--For SHARED Library and Debug Version
nmake /f makefile.vc BUILD=release--For SHARED Library and Release Version

After completing it , you will have dll or lib in "<path to wxwidgets>\lib\" depending on option provided in above commands.

Now include all files related to wxwidgets in your project.Mainly two paths are required to include "<path to wxwidgets>\inlcude\" and "<path to wxwidgets>\lib\vc_<lib\dll>".

After that link your wxwidgets generated library to your project.To do this inlcude "<path to wxwidgets>\lib\vc_<lib\dll>" to your project property in library section.

Now add below preprocessors to your project.

_WINDOWS
NDEBUG(For Release)
_DEBUG(For Debug)
_CRT_SECURE_NO_DEPRECATE=1
_CRT_NON_CONFORMING_SWPRINTFS=1
_SCL_SECURE_NO_WARNINGS=1
__WXMSW__
_UNICODE

After that add following library to your project from "<path to wxwidgets>\lib\vc_<lib\dll>"

wxbase30u_net
wxmsw30u_core
wxbase30u
wxtiff
wxjpeg
wxpng
wxzlib
wxregexu
wxexpat
wxmsw30u_adv

Based on your compiled options , library name can be little bit different.

I think I have covered all the steps to run wxWidgets.

Even if you got errors , You can check minimal project in "<path to wxwidgets>\samples"
directory. Try to run that project , and even if you got error then your wxwidgets is not built properly.

Hope this will help.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文