Separate Source File To More Than One.

Hello Everyone.

I have been searching for a while about how to separate source file to more than one.I have read some tutorials but I'm really confused.
I know that declarations must be on a header file. But let me give you an
example on my current project so you can help me.

I have a file with a class and many functions declared inside the class.
i want to add each function to a separate file and also the class into a header file.

So.How can i do it ?
I tried this:

main.cpp ( #include "class.h" )
function1.cpp ( #include "class.h)
function2.cpp ( #include "class.h)
class.h ( #ifndef CLASS_H, #define CLASS_H ,#endif)

The Problem on compiling is that everything is underclared.
16 maingame.cpp `mymusic' undeclared (first use this function)

Can someone explain me what's wrong ?
Thanks In Advance !

Why is everything undeclared? mymusic is defined in class.h? Can you post code?

BTW, it is really not recommended to split member functions of a class into separate
implementation files. To allow the compiler the best chances for optimization, you should
place all of them in a single .cpp file.
Topic archived. No new replies allowed.