|
-
Sep 8th, 2002, 04:35 PM
#1
Thread Starter
New Member
Managing multiple C++ files in one project
Hello, I am working on a project that I feel will be rather big, so instead of having all my code in one huge cpp file I wish to split the cpp files so that one cpp file handles one set of functions, and another cpp file handles another set of functions.
I really am clueless how to do this. When I tried at first to add cpp files, then I get the error message that some of my global variables have not been declared.
What is the best and most organized way of solving my problem? Any help will be appreciated.
Thanks.
-
Sep 8th, 2002, 10:40 PM
#2
Hyperactive Member
'extern' all your variables in all other cpp files, except the one they are declared in.
eg,
extern int cnt;
extern char mychar;
This is to tell the compiler that those variables have been declared elsewhere but not in this cpp file(external to this file)
-
Sep 9th, 2002, 04:07 AM
#3
Or better yet, extern them in a common header file.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Sep 9th, 2002, 10:04 PM
#4
Thread Starter
New Member
Thank you
I would just like to sincerely thank you guys for answering my question in a simple manner.
I got it to work exactly how I wanted it to and now I can easily go back and forth between different sections of code.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|