Skip to main content
GameDev.net gamedev.net
🔒 Locked

help with compiler directives

Started by nino Nov 12, 2000 at 2:24 AM 4 replies 600+ views
Original Post
nino
nino
i need help!!! ok i know how to use compiler directives #ifndef, #define and #endif to make sure a library is only compiled once but it is being compiled twice in my program and making errors for some reason here is the code. help would be greatly appreciated ///////////////////////////////////////////////////////// // Pong.h: interface for the Pong class. // ////////////////////////////////////////////////////////////////////// #ifndef _PONG_H #define _PONG_H #include #include typedef struct PaddleType { PaddleType(); // constructor char *filename; // name of bitmap for paddle LPDIRECTDRAWSURFACE7 PaddleSurf;// dd surface for paddle RECT bbox; // a bounding box for collision detection int velocity; // vertical velocity of paddle }Paddle; PaddleType:: PaddleType() :filename(NULL), PaddleSurf(NULL) { } class Pong { private: Paddle Player1; // struct for p1's paddle Paddle Player2; // struct for p2's paddle public: Pong(); ~Pong(); }; #endif Can anyone tell me whats wrong with it? thanks NiNo Edited by - nino on 11/12/00 2:41:54 AM
nino
nino
can someone please help i''m stuck till i figure this out
HELP!!!!!!!!!!

NiNo
SiCrane
SiCrane
I''m guessing that you''re getting a link time error with multiple implementations of the Paddle constructor. Try moving the Paddle constructor inside the struct definition, so that it will interpreted as a inline function of the struct.
nino
nino
thnaks SiCrane that helped but the library is still being compiled 2 times instead of one time because it always gives me the same error twice

thanks

NiNo
nino
nino
someone help me please i can''t figure it out

NiNo
Quantum
Quantum
What''s the error it gives you?

Topic Locked

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

Sign in to reply to this topic.