Hi, I've two classes (Server and Network) which have a template function defined in the .h file because we must define template function to header files.
The problem is that the class Network needs to include the class Server and the class Server needs to include the class Network.
And I can't make any forward declaration otherwise I have incomplete type errors.
How can I handle solve this ?
C:\Program Files (x86)\ODFAEG\include\odfaeg\Graphics\application.h|138|error: invalid use of incomplete type 'class odfaeg::network::SrkServer'|
Even if I use a pointer to the server in class network it doesn't compile.
The C++ #include system is fancy copy-paste. Anything that you can set up with multiple header files can also be done in a single compilation unit (i.e. a single .cpp file).
It's hard to say what exactly needs to change in your setup w/o seeing more code. Can you show some excerpts of your code so we can understand your design?
At some point, you probably need to forward declare one of the classes before you #include its respective header file.
Here is an example of it all in 1 file, but I'm trying to find a nice way to actually demonstrate multiple files online: