-
simple "#define" error
hi,
i star to learn win32, know im in the menu creation topic with resource files, i come from a c++ background, so i think my problem is that im not using the #defines rigth,
Code:
//winmain file
#include <windows.h>
//my definitions file
#include "ids.h"
int WINAPI WinMain (......
{
......
}
the definitions file:
ids.h
Code:
#define CM_PRUEBA 100
#define CM_SALIR 101
the resource file
myres.rc
Code:
#include "ids.h"
//a simple menu with 2 items
Menu MENU
BEGIN
POPUP "&Principal"
BEGIN
MENUITEM "&Prueba", CM_PRUEBA
MENUITEM SEPARATOR
MENUITEM "&Salir", CM_SALIR
END
END
ok heres the error,
I'm using vc++ 6.0
C:\programas win32\menus4_con_archivo_RECURSO_PERSONAL\ids.h(2) : fatal error RC1004: unexpected end of file found
if i remove in the rc file the #include"ids.h" and use
Code:
#define CM_PRUEBA 100
#define CM_SALIR 101
Menu MENU
BEGIN
POPUP "&Principal"
BEGIN
MENUITEM "&Prueba", CM_PRUEBA
MENUITEM SEPARATOR
MENUITEM "&Salir", CM_SALIR
END
END
everything works fine, any idead what am i doing wrong?
thanks for any help and please excuse my poor english
-
Hello,
Your header file and resource file seem to be fine. When I run into errors such as "fatal error RC1004: unexpected end of file found", it usually means only one thing. This error can be caused by omitting the linefeed and carriage return characters on the last line of a text file.
The resource compiler generates the following errors when the .RC file includes a .H file whose last line is a define (that is, there was no final carriage return at the end of the #define statement).
Why? The resource compiler preprocessor follows C syntax. A newline character is required on a #define statement.
How to fix it: Add a carriage return following the #define.
- Stack Overflow
-
you mean a simple enter or a '\n'?
thanks for reply
-
By carriage return, I mean't adding an actual enter in your header file.
If you can see the difference, here is your current header ids.h:
Code:
#define CM_PRUEBA 100
#define CM_SALIR 101
And here is the new one:
Code:
#define CM_PRUEBA 100
#define CM_SALIR 101
// New line above [Carriage return]
- Stack Overflow
-
Pressing enter! like
this... :D
//edit: post beated
-
hehe, i feel dumb :D
thanks a lot for yer help know my code works fine