Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

liquid_ice_programmer

directdraw memset() problem

This topic is 5530 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i am getting these errors: Compiling... DD.cpp C:\WINDOWS\Desktop\C++ Folder\General Windows\DD\DD.cpp(28) : error C2501: ''memset'' : missing storage-class or type specifiers C:\WINDOWS\Desktop\C++ Folder\General Windows\DD\DD.cpp(28) : error C2373: ''memset'' : redefinition; different type modifiers c:\program files\microsoft visual studio\vc98\include\string.h(103) : see declaration of ''memset'' C:\WINDOWS\Desktop\C++ Folder\General Windows\DD\DD.cpp(28) : error C2078: too many initializers C:\WINDOWS\Desktop\C++ Folder\General Windows\DD\DD.cpp(31) : error C2143: syntax error : missing '';'' before ''.'' C:\WINDOWS\Desktop\C++ Folder\General Windows\DD\DD.cpp(31) : error C2501: ''ddsd'' : missing storage-class or type specifiers C:\WINDOWS\Desktop\C++ Folder\General Windows\DD\DD.cpp(31) : error C2371: ''ddsd'' : redefinition; different basic types C:\WINDOWS\Desktop\C++ Folder\General Windows\DD\DD.cpp(22) : see declaration of ''ddsd'' C:\WINDOWS\Desktop\C++ Folder\General Windows\DD\DD.cpp(31) : error C2143: syntax error : missing '';'' before ''.'' C:\WINDOWS\Desktop\C++ Folder\General Windows\DD\DD.cpp(32) : error C2143: syntax error : missing '';'' before ''.'' C:\WINDOWS\Desktop\C++ Folder\General Windows\DD\DD.cpp(32) : error C2501: ''ddsd'' : missing storage-class or type specifiers C:\WINDOWS\Desktop\C++ Folder\General Windows\DD\DD.cpp(32) : error C2371: ''ddsd'' : redefinition; different basic types C:\WINDOWS\Desktop\C++ Folder\General Windows\DD\DD.cpp(22) : see declaration of ''ddsd'' C:\WINDOWS\Desktop\C++ Folder\General Windows\DD\DD.cpp(32) : error C2143: syntax error : missing '';'' before ''.'' C:\WINDOWS\Desktop\C++ Folder\General Windows\DD\DD.cpp(33) : error C2143: syntax error : missing '';'' before ''.'' C:\WINDOWS\Desktop\C++ Folder\General Windows\DD\DD.cpp(33) : error C2501: ''ddsd'' : missing storage-class or type specifiers C:\WINDOWS\Desktop\C++ Folder\General Windows\DD\DD.cpp(33) : error C2371: ''ddsd'' : redefinition; different basic types C:\WINDOWS\Desktop\C++ Folder\General Windows\DD\DD.cpp(22) : see declaration of ''ddsd'' C:\WINDOWS\Desktop\C++ Folder\General Windows\DD\DD.cpp(33) : error C2143: syntax error : missing '';'' before ''.'' C:\WINDOWS\Desktop\C++ Folder\General Windows\DD\DD.cpp(188) : warning C4508: ''CreateDirectDrawSurface'' : function should return a value; ''void'' return type assumed Error executing cl.exe. DD.exe - 15 error(s), 1 warning(s) and this is where aree therros seem to be: // Include Files #include <windows.h> #include <string.h> #include <ddraw.h> #include <ddrawex.h> //Clearing Memory memset(&ddsd,0,sizeof(ddsd)); //CreateDirectDrawDesc ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; can someone please help me

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
You should be sending sizeof() the variable type not the name of your variable. So it should be whatever variable type ''ddsd'' is, for example, sizeof(int) etc. That should alleviate some of your errors.

Somebody correct me if I am wrong.

Share this post


Link to post
Share on other sites
You''re wrong. That''s perfectly legal use of the sizeof operator.

If I had to guess, I''d say it was code in the source file before the code you posted. Things like forgetting a semi-colon or unmatched braces can trickle down to following statements.

Um, that code you posted... is it inside a function in your source file, or just plastered in the file right after the includes (as you''ve posted it)?




Share this post


Link to post
Share on other sites
I tried to use DDSURFACEDESC2 in sizeof() but still got same errors. That piece of code in not in a function and i have and my seimcolons and stuff like that right i looked. Does anything have a idea?

Share this post


Link to post
Share on other sites
EDIT: it's not in a fuction, and yet you expect it to execute? Hmm... gosh, I think I see the problem.


How appropriate. You fight like a cow.

[edited by - sneftel on May 4, 2003 3:43:41 PM]

Share this post


Link to post
Share on other sites
I am read Tricks of the windows game programming and it does not have any of this in a fuction:

//Clearing Memory

memset(&ddsd,0,sizeof(ddsd));

//CreateDirectDrawDesc
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;

so does anyone else no what is wrong.

[edited by - liquid_ice_programmer on May 4, 2003 4:18:42 PM]

Share this post


Link to post
Share on other sites
I can tell you 100% for certain, that code needs to be in a function. Period. Sounds like your book just left out pieces of the code, and assumed that you''d fill them in.

Trust me on this. All executed statements must be present in a function. Period.

Share this post


Link to post
Share on other sites
That is the code for initilializing the primary screen surface and like all C code in need to be in a function.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!