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

stupid question....

Started by GOOSEDUMP Oct 6, 2001 at 11:08 PM 1 replies 300+ views
Original Post
GOOSEDUMP
GOOSEDUMP
how do you include a file with common code but avoid linking errors? I have something like this.. #ifndef _STUFF_ #define _STUFF_ void method1() { } void method2() { } #endif but when I include this header in multiple files, when its being linked, it comlains for redundant definitions... It might be I havn''t slept in two nights.. I just don''t see it..
Redleaf
Redleaf
You can have function prototypes in a header, but you cannot place global function definitions in a header if you include the header in multiple source files.

I''d suggest moving your definitions to a separate source file, but retaining the prototypes of those functions in that header.

"Don''t be afraid to dream, for out of such fragile things come miracles."
GOOSEDUMP
GOOSEDUMP
Cheers! sleep....

Topic Locked

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

Sign in to reply to this topic.