hi,
if i iunderstand you right, you should use header files.
basically, the function 'bob' which you call from within file02 has to =
be declared in file02. a declaration is just the function head and a =
terminating semicolon, i. e.
void bob(void);
in your file02, before you first use bob().
but when function 'bob' along with other functions from file01 is used =
in many files, that's much work. on the other hand, you cannot include =
file01 in file02, because file01 would then be included twice in =
main.cpp.
so you should create a header file for 'file01.cpp', name it 'file01.h' =
and include it in every file that uses things from file01.cpp:
file01.h:
blabla
void bob(void); // declaration
blabla
file02.cpp:
blabla
#include "file01.h"
blabla
bob();
if you use this mechanism (.h / .cpp), you should, maybe later, also use =
it in your main.cpp.
hope i could help you.
anton tichawa
----- Original Message -----=20
From: Stein Nyg=E5rd <ste...@ge...>
To: <dev...@li...>
Sent: Thursday, September 27, 2001 7:47 PM
Subject: [Dev-C++] Project in DevCpp4 (files 'n stuff)
> Hi all!
>=20
> I having serious problems with my projects... I would like to split my =
code
> up into some different files, to make it more ease to navigate. But, =
when I
> put functions all around different files, they cant call eachother, if =
that
> makes any sense.
>=20
> Example:
>=20
> main.cpp:
>=20
> #include "file01.cpp"
> #include "file02.cpp"
> void main(void)
> {
> wierd(); file://works Ok :/
> }
>=20
> file01.cpp:
> void bob(void)
> {
> blabla
> }
>=20
>=20
> file02.cpp:
> void wierd(void)
> {
> bob(void) file://isn't working!
> }
>=20
>=20
> And the files ARE include to my project, and everything seems to be =
right,
> but it isn't working for me... what's wrong??
>=20
> Thanks! :)
> Stein
>=20
>=20
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|