Visual C ++(VS2010)构建资源文件 [英] Visual C++ (VS2010) Build Resource Files

查看:76
本文介绍了Visual C ++(VS2010)构建资源文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好.

我将一些位图导入到我的Visual c ++ win32控制台应用程序项目中.

为此,我右键单击项目,然后单击添加"->新建过滤器".现在,我将帽子过滤器命名为"gfx",然后将一些位图导入其中.

现在,问题是当我构建我的应用程序时,"gfx"文件夹没有被构建.我使用具有相对路径的自定义函数来加载文件:

LoadFile(.\\ gfx \\ grid.bmp")

但是它不存在,因为应该在应用程序所在的位置构建"gfx"文件夹和位图.

在Visual Basic(以及C#)中,当我在项目中包含一个文件并将其设置为content并总是复制"属性时,每次构建该应用程序时,该文件夹及其位图都会在我的应用程序文件夹中构建.
如何在Visual C ++中实现类似的功能?任何帮助将不胜感激.

Hey all.

I am import some bitmaps into my Visual c++ win32 console applications project.

To do that I right click on the project then Add->New Filter. Now I named hat filter "gfx" then imported some bitmaps into it.

Now, the problem is when I build my application the "gfx" folder is not being built. I use a custom function with a relative path to load the file:

LoadFile(".\\gfx\\grid.bmp")

But it does not exist because the "gfx" folder and the bitmaps should be built where the application resides.

In Visual Basic(C# as well) when I include a file in the project and set it as content and "always copy" property, every time I build the app, the folder and it''s bitmaps get built in my app folder.
How can I achieve similar functionality in Visual C++?? Any help would be appreciated.

推荐答案

您期望从此构建过程中获得什么样的输出,以及将运行什么程序来实现?除非Visual Studio生成过程可以识别文件类型,否则添加筛选器不会执行任何操作.您可能需要添加处理这些文件类型的自定义构建步骤.
What sort of output do you expect from this build process and what program will be run to achieve it? Adding a filter does nothing unless the file type is recognised by the Visual Studio build processes. You probably need to add a custom build step that handles these file types.


这篇关于Visual C ++(VS2010)构建资源文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆