Skip to main content
gamedev.net
🔒 Locked

#define errors

Started by 3dmodelerguy 1 reply 750+ views
Original Post
3dmodelerguy
3dmodelerguy
here is my code: #ifndef DEFINES_H #define DEFINES_H #include "PrecompiledHeaders.h" #define AddGLSupport( wxString name, wxFrame frame, wxPoint point, wxSize size, DWORD style, wxString string ) wxGLCanvas *name = new wxGLCanvas( frame, -1, point, size, style, string); #endif here are my errors: Deleting intermediate files and output files for project 'Stromgage 3D Game Engine - Win32 Debug'. --------------------Configuration: Stromgage 3D Game Engine - Win32 Debug-------------------- Compiling... PrecompiledHeaders.cpp Compiling... GameWindow.cpp GLCanvas.cpp MainApp.cpp c:\stromgage 3d game engine\stromgage 3d game engine\defines.h(6) : error C2010: 'n' : unexpected in macro formal parameter list c:\stromgage 3d game engine\stromgage 3d game engine\defines.h(6) : error C2010: 'f' : unexpected in macro formal parameter list c:\stromgage 3d game engine\stromgage 3d game engine\defines.h(6) : error C2010: 'p' : unexpected in macro formal parameter list c:\stromgage 3d game engine\stromgage 3d game engine\defines.h(6) : error C2010: 's' : unexpected in macro formal parameter list c:\stromgage 3d game engine\stromgage 3d game engine\defines.h(6) : error C2010: 'S' : unexpected in macro formal parameter list c:\stromgage 3d game engine\stromgage 3d game engine\defines.h(6) : error C2010: 's' : unexpected in macro formal parameter list c:\stromgage 3d game engine\stromgage 3d game engine\defines.h(6) : error C2009: reuse of macro formal 'wxString' c:\stromgage 3d game engine\stromgage 3d game engine\defines.h(7) : error C2065: 'frame' : undeclared identifier c:\stromgage 3d game engine\stromgage 3d game engine\defines.h(7) : error C2065: 'point' : undeclared identifier c:\stromgage 3d game engine\stromgage 3d game engine\defines.h(7) : error C2065: 'size' : undeclared identifier c:\stromgage 3d game engine\stromgage 3d game engine\defines.h(7) : error C2065: 'style' : undeclared identifier c:\stromgage 3d game engine\stromgage 3d game engine\defines.h(7) : error C2065: 'string' : undeclared identifier what are these errors?
Auron
Auron
Your errors are most likely coming from trying to give your macro parameters types. The preprocessor literally just copies and replaces for macros. Because of this it's impossible to perform any type checking on its parameters.

Also, if you're trying to make that second line part of the macro, you have to put a backslash at the end of the first line.

-Auron
Drew_Benton
Drew_Benton
Auron is right about the backslash ( \ ) at the end of the line. I made a post b/c i didn't see he said that, then I reread and was like darn...i was beat to it [smile].

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.