Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums

Go Back   Code Forums > Application and Web Development > Platform/API C++

Reply
 
LinkBack Thread Tools Display Modes
Old 12-11-2004, 02:23 PM   #1 (permalink)
harker
Registered User
 
Join Date: Dec 2004
Posts: 4
harker is on a distinguished road
Newbie, can't not work out what's wrong with this code

Hi there,

I have a main piece of code that inlucdes a resource file.

I have followed the tutorials, and tried to make my way from there.

I keep getting a compile error saying that a constant 'ICON_GROUP', define in 'resources.h', is not defined. This is a win32 application by the way.

Here is my resources.h file

Code:
#define ICON_GROUP 1002
#define ICON_LEAF 1003
#define ICON_DL 1004
#define ICON_RIP 1005
#define MY_TREE 1000
#define MAIN_WINDOW 1001
here is my resources.rc file
Code:
#include "resources.h"

ICON_GROUP ICON "./resources/collection.ico"
ICON_LEAF ICON "./resources/treble.ico"
ICON_RIP ICON "./resources/rip.ico"
ICON_DL ICON "./resources/download.ico"
this is the code snippet that contains the erroneous code

Code:
#include <windows.h>
#include <commctrl.h>
#include "resources.h"
#include "MyWinTree.h"

.....


if ((himl = ImageList_Create(16, 
                                 16,
                                 FALSE, 
                                 4, 0)) == NULL) 
        return NULL; 

    // Add the open file, closed file, and document bitmaps. 
    hbmp = LoadBitmap(tree.group(), MAKEINTRESOURCE(ICON_GROUP)); 
    g_nOpen = ImageList_Add(himl, hbmp, (HBITMAP)NULL); 
    DeleteObject(hbmp); 
...
Additional info: the MyWinTree.h file contains a class declaration for a wrapper to a windows Tree_View. It also includes 'resources.h'

I am using Bloodshed Dev-C++ to compile with.

Any help would be appreciated

I am a java programmer trying to make add C++ to his belt

Regards

Steve
harker is offline   Reply With Quote
Old 12-11-2004, 09:35 PM   #2 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
I've moved this to the API section since this is the standard C/C++ forum. Read the sticky topic on rules. Besides that, I think that especially the veterans are not really win32 oriented.
__________________
Valmont is offline   Reply With Quote
Old 12-12-2004, 03:40 AM   #3 (permalink)
harker
Registered User
 
Join Date: Dec 2004
Posts: 4
harker is on a distinguished road
ok thanks,

wasn't sure whether the crux of the problem was strictly win32 related or acutally just a general c++ problem, hence I placed it in the general section

Regards

Steve
harker is offline   Reply With Quote
Old 12-13-2004, 12:15 AM   #4 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,720
redhead is on a distinguished road
Quote:
Originally Posted by harker
I keep getting a compile error saying that a constant 'ICON_GROUP', define in 'resources.h', is not defined. This is a win32 application by the way.

Here is my resources.h file

Code:
#define ICON_GROUP 1002
#define ICON_LEAF 1003
#define ICON_DL 1004
#define ICON_RIP 1005
#define MY_TREE 1000
#define MAIN_WINDOW 1001
Could it be, that you're including your resources.h file so many times that the compiler gets confused ??
Try controling your needed includes like:
resources.h
Code:
#ifndef RESOURCES__H__
#define RESOURCES__H__

#define ICON_GROUP 1002
#define ICON_LEAF 1003
#define ICON_DL 1004
#define ICON_RIP 1005
#define MY_TREE 1000
#define MAIN_WINDOW 1001

#endif
That might give a clue, since I never heard of a compiler giving that error, when the file already has been included.
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Old 12-13-2004, 01:48 AM   #5 (permalink)
harker
Registered User
 
Join Date: Dec 2004
Posts: 4
harker is on a distinguished road
No sadly didn't work still get

'ICON_GROUP' undeclared

Hmm, done a heap of tutorials to get the basics, not sure what I am doing wrong.
harker is offline   Reply With Quote
Old 12-13-2004, 03:21 AM   #6 (permalink)
harker
Registered User
 
Join Date: Dec 2004
Posts: 4
harker is on a distinguished road
Solved

I take that back,

It did work.

There was another problem, related to where the IDE was placing the files. Once I overcame that, I still had the problem, I tried your solution and everything if fine now.


Thanks

Steve
harker is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Would you mind if there were small flash elements at code newbie? sde Lounge 10 05-29-2004 09:05 PM
The Largest Tutorial in Code Newbie History! sde Code Newbie News 5 04-24-2004 07:19 PM
promoting code newbie sde Lounge 3 02-13-2004 06:54 AM


All times are GMT -8. The time now is 03:55 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting