PDA

View Full Version : public functions?



CyBBe
05-08-2000, 10:04 AM
Small problem: If I have a function (int name(int x)) that I wish to use in all my cpp files, in the same project, where should I declar it???

skw|d
05-08-2000, 06:22 PM
It is considered back practice, so I suggest you redesign your program a bit. But here is how...

you can use 'extern'.

For each source file that needs to call the function, put this at the top:


extern int name(int x);

For the one source that defines the function:


int name( int x ) {
// stuff
}


/skw|d

john
05-08-2000, 06:41 PM
uh huh. and isn't this off-topic?

(OpenGL != C++ != language semantics)