954,506 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Question related to using multiple files

This may be a dumb question. But is it possible to use multiple files in a single program without using header files concept. Perhaps maybe using the "extern" keyword.

abhi_elementx
Junior Poster
119 posts since Dec 2007
Reputation Points: 11
Solved Threads: 7
 

Yes, you can do that. The problem is that you are doing double the work that is necessary, and its very easy to make mistakes in the extern statements between the different files. If you only have one or two variables/functions you want to declare extern then by all means just put the statement at the top of the *.cpp files that need them.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

Any tutorials for more info?

abhi_elementx
Junior Poster
119 posts since Dec 2007
Reputation Points: 11
Solved Threads: 7
 

why do you need a whole tutorial just to declare an object with the extern keyboard? Its pretty trivel to code. Just put this near the top of the *.cpp file.
extern int something;

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

OK yeah...got that!

abhi_elementx
Junior Poster
119 posts since Dec 2007
Reputation Points: 11
Solved Threads: 7
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You