Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Apr 27th, 2005, 10:14 AM   #1
some1
Programmer
 
Join Date: Dec 2004
Posts: 50
Rep Power: 4 some1 is on a distinguished road
Including header files

How to prevent header files from being included twice?
My code is messed up and I need to include lots of .h files in other files so I get errors from the linker that X is already defined in x.obj file.

I tried using inclusion guards like this:

#ifndef INC_HEADER1
#define INC_HEADER1

<file content goes here>

#endif

and also tried

#pragma once

but i still get the same errors
But even if i include e.g windows.h or string.h a hundred times i never get linker errors about them.

help?
some1 is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:09 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC