🔒 Locked
stupid question ?
Advertisement
Original Post
I''m trying (I said trying) to begin game developpement with directx (and I''m also trying to speak english...)
BUT
When I try to compile my c file visual c++ tells me :
error c2039 : setcooperativelevel is not a member of IDirectdraw
or release is not...
or queryinterface is not...
What should I do before turning off my computer and watch TV ?
Thanks,
Stupido.fr
God save gamedev !
C/C++ is case sensitive. myVar is NOT the same as myvar. Change setcooperativelevel to SetCooperativeLevel, release to Release, queryinterface to QueryInterface, etc.
When I wrote setcooperativelevel, I wanted to say SetCooperativeLevel. In fact, I nearly copied the code of the tutorial into a win32 file.
And I still wonder why it doesn''t work since this error is not mentioned in the directdraw tutorial
please help
Ste1000
God save gamedev !
And I still wonder why it doesn''t work since this error is not mentioned in the directdraw tutorial
please help
Ste1000
God save gamedev !
Can you post your exact code? It''s hard to tell what''s going wrong when you just describe it like that.
-Ironblayde
Aeon Software
-Ironblayde
Aeon Software
lol
missing semicolons, open/close brackets, double/single quotation marks, ->/. , */&
then if everything else failed. then look at the errors that compiler gave you
(i got point by that ya know)
"The more crap you put up with, the more crap you are going to get" -Pouya
"The longest recorded flight of a chicken is 13 seconds!" -?
missing semicolons, open/close brackets, double/single quotation marks, ->/. , */&
then if everything else failed. then look at the errors that compiler gave you
(i got point by that ya know)
"The more crap you put up with, the more crap you are going to get" -Pouya
"The longest recorded flight of a chicken is 13 seconds!" -?
ok
First, thanks to all for your answers...
But unfortunately it didn''t work
So here is my code (not the entire code but enough I think) :
LPDIRECTDRAW lpDD;
LPDIRECTDRAW lpDD2;
int DirectDrawInit(HWND hwnd)
{
HRESULT ddrval;
ddrval = DirectDrawCreate( NULL, &lpDD, NULL );
if( ddrval != DD_OK ) { return(0); }
ddrval = lpDD->QueryInterface(IID_IDirectDraw2,(LPVOID *)&lpDD2);
if( ddrval != DD_OK ) { lpDD->release(); return(0); }
lpDD->release();
ddrval = lpDD2->SetCooperativeLevel( hwnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN );
if( ddrval != DD_OK ) { lpDD2->Release(); return(0); }
ddrval = lpDD2->SetDisplayMode( 640, 480, 8);
if( ddrval != DD_OK ) { lpDD2->Release(); return(0); }
return(1);
}
Now just think about this :
- I got 8 errors from visual c++ 5 :
error c2039 : SetCooperativeLevel is not a member of IDirectDraw
The same errors for Release, QueryInterface, SetDisplayMode,...
- I have specified #include
- I included ddraw.h into my project files
- In classview, I can see IDirectDraw, IDirectDraw2,...
In IDirectDraw, I can see SetCooperativeLevel and SetDisplayMode for example : BUT When I try to see the functions definitions, the compiler says : "Cannot find the definition for this function : classview cannot find the function definitions until they are saved at least once "
Hope you will be able to help me
Ste1000
God save gamedev !
First, thanks to all for your answers...
But unfortunately it didn''t work
So here is my code (not the entire code but enough I think) :
LPDIRECTDRAW lpDD;
LPDIRECTDRAW lpDD2;
int DirectDrawInit(HWND hwnd)
{
HRESULT ddrval;
ddrval = DirectDrawCreate( NULL, &lpDD, NULL );
if( ddrval != DD_OK ) { return(0); }
ddrval = lpDD->QueryInterface(IID_IDirectDraw2,(LPVOID *)&lpDD2);
if( ddrval != DD_OK ) { lpDD->release(); return(0); }
lpDD->release();
ddrval = lpDD2->SetCooperativeLevel( hwnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN );
if( ddrval != DD_OK ) { lpDD2->Release(); return(0); }
ddrval = lpDD2->SetDisplayMode( 640, 480, 8);
if( ddrval != DD_OK ) { lpDD2->Release(); return(0); }
return(1);
}
Now just think about this :
- I got 8 errors from visual c++ 5 :
error c2039 : SetCooperativeLevel is not a member of IDirectDraw
The same errors for Release, QueryInterface, SetDisplayMode,...
- I have specified #include
- I included ddraw.h into my project files
- In classview, I can see IDirectDraw, IDirectDraw2,...
In IDirectDraw, I can see SetCooperativeLevel and SetDisplayMode for example : BUT When I try to see the functions definitions, the compiler says : "Cannot find the definition for this function : classview cannot find the function definitions until they are saved at least once "
Hope you will be able to help me
Ste1000
God save gamedev !
Sole thing I could point out is the fact that maybe you haven''t the libraries loaded, or your directories are wrong or missing, or you simply haven''t the file on your disk. The code seems ok, nearly nice (sorry, I''m OGl fan, and I find DX quite messy
But of course that''s not the point).
The problem is around the "cannot-see-def" error... If you cannot see the definition of your classes, then it''s probably because you did something wrong. Solving it would problem wipe out the error list.
I''d guess that IDirectDraw is declared but contains nothing or something similar (he finds it but cannot tell where, or just #define #ifdef #ifndef problems... That might happens)
Have you tried it with VC6? Have you set correctly your directories in your options? Maybe it''s just cause the files are misplaced.
The problem is around the "cannot-see-def" error... If you cannot see the definition of your classes, then it''s probably because you did something wrong. Solving it would problem wipe out the error list.
I''d guess that IDirectDraw is declared but contains nothing or something similar (he finds it but cannot tell where, or just #define #ifdef #ifndef problems... That might happens)
Have you tried it with VC6? Have you set correctly your directories in your options? Maybe it''s just cause the files are misplaced.
Programming is:
|
(( BTW, he created lpDD2 from lpDD with QueryInterface... ))
Oh yeah! When you put code, please use the source tags... It gives something like this:
Oh and read a bit of Code Complete, please...
Just a trick, because lines like "if( ddrval != DD_OK ) { lpDD2->Release(); return(0); }" are really hard to read. Don''t take it personnally, I just want to give you tips
.
Oh yeah! When you put code, please use the source tags... It gives something like this:
|
Oh and read a bit of Code Complete, please...
Programming is:
|
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement