resource trouble

Started by
1 comment, last by ms75214 1 year, 3 months ago

I'm trying to learn to use resources in VC++.

I added a bitmap and called it IDB_BITMAP1. However, I keep getting warnings that IDB_BITMAP1 is undefined.

Here is my resource.h file:

//{{NO_DEPENDENCIES}}

// Microsoft Visual C++ generated include file.
// Used by gdiplustest.rc
//
#define IDC_MYICON                      2
#define IDD_GDIPLUSTEST_DIALOG          102
#define IDS_APP_TITLE                   103
#define IDD_ABOUTBOX                    103
#define IDM_ABOUT                       104
#define IDM_EXIT                        105
#define IDI_GDIPLUSTEST                 107
#define IDI_SMALL                       108
#define IDC_GDIPLUSTEST                 109
#define IDR_MAINFRAME                   128
#define IDB_BITMAP1                     129
#define IDC_STATIC                      -1

// Next default values for new objects
//  
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC                     1
#define _APS_NEXT_RESOURCE_VALUE        130
#define _APS_NEXT_COMMAND_VALUE         32771
#define _APS_NEXT_CONTROL_VALUE         1000
#define _APS_NEXT_SYMED_VALUE           110
#endif
#endif

Anyone know why it would say IDB_BITMAP1 is undefined when it is clearly defined in resource.h?

Thank you.

Advertisement

What is the exact error message? /edit: I see the screen shot, I missed it on mobile.

Did you include resource.h in your source file? Did you save the file after editing it so other tools can see the changes?

Resources are just numbered blobs of data attached to the program using the resource compiler. Yours happens to be a blob numbered 129. The #define value makes using the number more clear, and makes it easier to change if needed, but deep down it is just the number 129. Other than good style, nothing prevents you from using the raw number if you want, or keeping the number in some other constant or variable.

@frob I include gdiplustest.h, which looks like so:

#pragma once

#include "resource.h"

So, resource.h should be getting included.

This topic is closed to new replies.

Advertisement