我想在头文件中转发声明一个结构。
struct GLFWvidmode;
class DesktopVideoMode {
private:
const GLFWvidmode *videomode;
public:
DesktopVideoMode(const GLFWvidmode *videomode);
...
在 cpp 文件中,我将外部标头包含在定义中...
#include "DesktopVideoMode.hpp"
#include <GLFW/glfw3.h>
...发生错误“ Typedef reddefinition with different types ('struct GLFWvidmode' vs 'GLFWvidmode') ”:
typedef struct
{
/*! The width, in screen coordinates, of the video mode.
*/
int width;
/*! The height, in screen coordinates, of the video mode.
*/
int height;
/*! The bit depth of the red channel of the video mode.
*/
int redBits;
/*! The bit depth of the green channel of the video mode.
*/
int greenBits;
/*! The bit depth of the blue channel of the video mode.
*/
int blueBits;
/*! The refresh rate, in Hz, of the video mode.
*/
int refreshRate;
} GLFWvidmode;
在这种情况下我不能转发申报吗?