Skip to main content
gamedev.net
🔒 Locked

undefined identifier

Started by remi 8 replies 2.1k views
Original Post
remi
remi
I successfully used the fucntion "GetOpenFileName" in the past, but in my new project it doesn't work. I #include <#include <Commdlg.h> and the comdlg32.lib, but it doensn't solve the problem, i also read this but.... Anyhelp?

"...and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces."----------Scott Meyers, "Effective C++"
angry
angry
try setting the lStructSize member in OPENFILENAME struct to: OPENFILENAME_SIZE_VERSION_400
remi
remi
Sample of codes:

#include <Commdlg.h>
...
OPENFILENAME ofn;
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn); // SEE NOTE BELOW

ofn.hwndOwner = hWnd;
ofn.lpstrFilter = "Raw Files (*.raw)\0*.raw\0";//All Files (*.*)\0*.*\0";

ofn.lpstrFile = buffer;
ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
ofn.lpstrDefExt = "raw";
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;

if(GetOpenFileName(&ofn))
{
//

}


And these are the error messages i get:

'OPENFILENAME' : undeclared identifier
missing ';' before identifier 'ofn'
'ofn' : undeclared identifier
left of '.lStructSize' must have class/struct/union type
left of '.hwndOwner' must have class/struct/union type
left of '.lpstrFilter' must have class/struct/union type
left of '.lpstrFile' must have class/struct/union type
left of '.nMaxFile' must have class/struct/union type
left of '.Flags' must have class/struct/union type
'OFN_EXPLORER' : undeclared identifier
'OFN_FILEMUSTEXIST' : undeclared identifier
'OFN_HIDEREADONLY' : undeclared identifier
left of '.lpstrDefExt' must have class/struct/union type
left of '.lStructSize' must have class/struct/union type
'OPENFILENAME_SIZE_VERSION_400' : undeclared identifier
'GetOpenFileName' : undeclared identifier


[edited by - remi on July 12, 2003 11:36:38 PM]
"...and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces."----------Scott Meyers, "Effective C++"
angry
angry
#include <commdlg.h>
LoadLibrary("commdlg.dll");

try that :&
remi
remi
The problem persists!

BTW:The peace of code i showed is from an old program that worked and still working now, but when i copy and paste it in the new project it just failed to compile.
"...and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces."----------Scott Meyers, "Effective C++"
angry
angry
put rescue cd in cd drive. press the large reboot button on your computer... click some buttons and wait 30 minutes, and voila ;P

heh... can't come up with a better solution than that

edit: are you sure you're not screwing your code up somewhere before this code that could cause this eh weird error ?

[edited by - angry on July 12, 2003 11:47:20 PM]
remi
remi
I try making a new projet with the same *.h and *.cpp files but it''s not working.

I''ll try rebooting and c! Thanx anyway!
"...and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces."----------Scott Meyers, "Effective C++"
JohnBolton
JohnBolton
Perhaps you need "#include <windows.h>".
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
remi
remi
I did it( i''m making a windows program).
"...and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces."----------Scott Meyers, "Effective C++"
remi
remi
The problem is solved now!
It seems like #include "stdafx.h" should be put at the post most part of the #includes, don''t ask me why!
"...and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces."----------Scott Meyers, "Effective C++"

Topic Locked

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

Sign in to reply to this topic.