重新声明 C++ 内置类型 'wchar_t' [-fpermissive]

问题描述 投票:0回答:0
#include <iostream>
#include <stdio.h>
#include <tchar.h>

#include "sainaintque.h"

using namespace std;


#include <windows.h>
#include <glut.h>

void lineSegment(void)
{
  glClear(GL_COLOR_BUFFER_BIT);
  glColor3f(1.0, 0.0, 0.0);
  glBegin(GL_LINES);
  glVertex2i (180, 15);
  glVertex2i (10, 145);
  glEnd();
  glFlush();
}

void glDemo()
{
    int argc = 1;
    glutInit(&argc, nullptr);
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
    glutInitWindowPosition(50, 100);
    glutInitWindowSize(400, 300);
    glutCreateWindow("Example OpenGL Program");
    glClearColor(1.0, 1.0, 1.0, 0.0);
    glMatrixMode(GL_PROJECTION);
    gluOrtho2D(0.0, 200.0, 0.0, 160.0);
    glutDisplayFunc(lineSegment);
    glutMainLoop();
}

int main()
{


    sainaIntQue *sa = new sainaIntQue();

    sa->process("C:\\Users\\19593\\Documents\\qt\\build-print3d-Desktop_Qt_5_14_2_MinGW_32_bit-Debug\\all\\",
                "C:\\Users\\19593\\Documents\\qt\\build-print3d-Desktop_Qt_5_14_2_MinGW_32_bit-Debug\\all_Sec\\",
                2200, 2090, 1428, 15, true);



    cout<<"finished!!!"<<endl;

    return 0;
}

我使用qt运行上面的代码并得到以下错误:

enter image description here

我在glut.h的以下位置查找错误

#  ifndef _WCHAR_T_DEFINED
typedef unsigned short wchar_t;
#   define _WCHAR_T_DEFINED
#  endif

如何解决?

我发现了类似的问题,但是解决方案并没有解决我的问题 https://stackoverflow.com/questions/44853339/redeclaration-of-c-built-in-type-wchar-t-windows-10-glut-cpp

c++ glut
© www.soinside.com 2019 - 2024. All rights reserved.