C++ - 错误 C4430 : missing type specifier (for a constructor? ??)

标签 c++

从昨晚开始,我就一直被这个问题困扰着,而且我一直无法弄清楚为什么会这样。我一定遗漏了一些非常简单的东西。

我正在制作一个 OpenGL 程序。在这个程序中,我正在创建一个 DialogBox 类。下面是代码:

//---------------------------------------------------------------
//DialogBox.h
//---------------------------------------------------------------

#include <vector>

class DialogBox
{
    private:

      float X; float Y; float Z;
      float Width;
      float Height;

      float RED;
      float GREEN;
      float BLUE;
      float ALPHA;

      int currentLine; 
      int maxLines;    //How many lines of text this dialog box can hold
      int maxChars;    //How many chars each line of text can hold

      std::vector< std::vector<char> >Text; //Text contents of the Dialog Box

      unsigned int vertexArray_DialogBox;
      unsigned int vertexBuffer_DialogBox;


   public:

      DialogBox();
      DialogBox(float width, float height);

      void draw();
      void draw(float x, float y, float z);

};

//------------------------------------------------------------------------
//DialogBox.cpp
//------------------------------------------------------------------------

#include <iostream>
#include "DialogBox.h"

DialogBox::DialogBox()
{
    X = 0.0f; Y = 0.0f; Z = 0.0f;

    Width = 1.0f;
    Height = 1.0f;

    RED = 0.0f;
    GREEN = 1.0f;
    BLUE = 1.0f;
    ALPHA = 1.0f;

    //For HELVETICA_18 ----------------------
    static const float letter_width = 0.03f;
    static const float letter_height = 0.04f;
    static const float line_height = 0.1f;
    //---------------------------------------


   maxLines = Height / line_height - 4; 
   maxChars = Width / letter_width - 2; 

   Text.resize(maxLines);
   for(int i = 0; i < maxLines; i++)
   {
       Text[i].resize(maxChars);
   }
}

DialogBox::DialogBox(float width, float height)
{
    Width = width;
    Height = height;
    //The rest of the initialization codes
}

void DialogBox::draw()
{
    //OpenGL Drawing codes
}

void DialogBox::draw(float x, float y, float z)
{
    X = x; Y = y; Z = z;
    draw();
}

然后编译器抛出了这个错误信息:

enter image description here

我一直在努力,但我无法弄清楚编译器指的是什么。它必须是非常简单的东西(比如代码中的拼写错误或类似的东西)。预先感谢您的帮助。

最佳答案

同一行的警告是什么?

not enough actual parameters for macro 'DialogBoxA'

DialogBox 是一个#define-d 宏吗?如果是这样,那可能会把事情搞砸。

关于C++ - 错误 C4430 : missing type specifier (for a constructor? ??),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14429533/

相关文章:

python - 构建 Cython 模块时如何覆盖 -DNDEBUG 编译标志

c++ - 计算三角形网格中的法线

c++ - boost::multiprecision:如何将 mpz_int 变量转换为 gmp_int?

c++ - 强制 OpenMP 不在每个线程中缓存大对象

c++ - 虚拟继承、默认构造函数和额外复制

c++ - 在 Windows 上编译+分发 Linux 代码

c++ - 来自 QFrame 的 Qt 气球窗口

c++ - 如何在 win32 中获取 HWND?

c++ - Win32 : set default font and text color for rich edit

c++ - Producer-Consumer 生产者创建 2 个元素 POSIX 信号量