English 中文(简体)
在通过指挥线编造一个双赢32套时,我如何把一个弧(资源)档案联系起来?
原标题:how do I link a .rc (resource) file when compiling a win32 app with gcc through command line?
最佳回答

页: 1 请写:

#include "resource.h"
IDR_MYMENU MENU
BEGIN
.
.
.
END
问题回答

FFWD to 2020 Q4. In the era of VS Code, a lot of people are somewhat struggling with "beyond the basics" when trying to compile WIN32 GUI "Hello World" without Visual Studio. And yes, the resource file is probably the main stumbling block. That is a wider subject.

由于问题只是关于如何“编织”弧卷的问题,请允许我仅回答这个问题。

下面请看一下你还有<编码>my_app.rcresource.h

  • to avoid some potential big hassle make sure you have #include <windows.h> at the top of the rc file
  • resource compiler is called rc. If cl.exe is on the path, rc.exe is too.
  • rc makes a binary res file from the rc file.
  • rc my_app.rc will produce my_app.res
    • of course only if your rc file has no mistakes in there.
    • if rc can not find windows.h you can add the path to it like so rc /i"C:Windows Kits10Include10.0.18362.0um" my_app.rc
    • with your local path of course.
  • to use the res, on the cl command line you need to pass the res file to the linker, like on this imaginary example cl compilation command line
cl /Zi /EHsc /Fe:my_app.exe my_app.cpp /link my_app.res

确保<条码>/link是<条码>的最后一个论点。

http://www.ohchr.org。

让我们承担项目内容:

my_app.cpp
resource.h
my_app.rc

First, you will need to produce my_app.res as described above. Second, in the VS Code .vscode/tasks.json, you will have:

{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: cl.exe build active file",
            "command": "cl.exe",
            "args": [
                "/Zi",
                "/EHsc",
                "/Fe:",
                "${fileDirname}\${fileBasenameNoExtension}.exe",
                "${file}",
                "/link /SUBSYSTEM:WINDOWS ${fileDirname}\${fileBasenameNoExtension}.res",
            ],
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "problemMatcher": [
                "$msCompile"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "compiler: cl.exe"
        }
    ]
}

通知<代码>/link 您需要在生成的其他标准任务档案中添加这一论点。 开放式<代码>my_app.cpp 并CTRL+SHIFT+B。 这将汇编并链接到您的WIN32 App,包括你们的资源。





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签