Well, I've managed to strip it to just a few files. I'm posting the code below.
|
File: reliableudp.h
Code:
#ifndef RELIABLEUDP_H_ Code:
#ifndef BASESOCKET_H_ Code:
#ifndef SERVERSOCKET_H_ Code:
#ifndef SOCKET_H_ |
The above is a complete program. I'm compiling it as a shared library. As you can see, it's just a skeleton program. But I still get the error.
|
I forgot to mention, I'm using the cmake utility. The CMakeLists.txt file is written as follows:
Code:
SET(RUDP_SRC |
guards are the combination #ifndef with #define and #endif which wraps around the definition in the header files. Hence BaseClass.h would be:
Code:
#ifndef BASE_CLASS |
Well, I tried changing the guard, just to be sure it wasn't conflicting with any other. The problem persists.
|
whatever i think is that you have saved your code in .c file if its so then change it to cpp. its just a guess from my side.
|
Nopes. All the code is in .cpp files.
|
No one can help me?
|
On the little that you have given, you have had quite a bit of help. It's probably up to you now to help yourself and post some code...
|
But I already have posted some code. Scroll up and look for yourself. It fulfills all of your requirements. It's complete and concise. What more is required?
|
An update. On a fluke, I commented the line #include "reliableudp.h" in BaseSocket.h. The error disappeared. Unfortunately, I can't do this in the main project because it introduces a lot of dependency issues. Also, the same thing is done in all of the other files, but it doesn't give an error there. I do not understand what the problem is?
|
Quote:
I'm not certain why you are using the forward declarations. I'm sure that it your problem. if you do need them then put them in the file that requires it, that is if ServerSocket also needs to know about Socket then put it in ServerSocket.h |
Hi,
I've had a proper look at it now and managed to duplicate your problem. In C++ you can't have a forward declaration of a base class, that is the following will fail. Code:
#ifndef SOCKET_H_ Code:
#ifndef SOCKET_H_ To recreate the problem I had the line #include "BaseSocket.h" in the file BaseSocket.cpp Now what is happening with your code is as follows:
|
hello i'm no expert by i think they are refering to your guard
Code:
#ifndef BASE_CLASS_HPP hth paul |
All times are GMT -5. The time now is 07:30 AM. |