error: invalid use of incomplete type 'struct QWidget'

  • From: "8Observer8" < >
  • To:
  • Subject: error: invalid use of incomplete type 'struct QWidget'
  • Date: Fri, 30 Nov 2012 05:05:44 -0500

Hi, everyone!

It works well:


Code:

#include <QApplication>
#include <QLabel>

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QLabel *label = new QLabel("<b>Hello</b>, World!");

    label->show();

    return app.exec();
}




But it doesn't work:


Code:

#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QWidget *window = new QWidget;

    window->show();
    return app.exec();
}




Output:

> 
> "/bin/make" -f nbproject/Makefile-Debug.mk 
> QMAKE=/C/QtSDK/Desktop/Qt/4.7.4/mingw/bin/qmake.exe SUBPROJECTS= .build-conf
> make[1]: Entering directory `/d/_Projects/C++/Objects/ObjectsGUI/Objects'
> /C/QtSDK/Desktop/Qt/4.7.4/mingw/bin/qmake.exe VPATH=. -spec win32-g++ -o 
> qttmp-Debug.mk nbproject/qt-Debug.pro
> mv -f qttmp-Debug.mk nbproject/qt-Debug.mk
> "/bin/make" -f nbproject/qt-Debug.mk dist/Debug/MinGW_Qt-Windows/Objects.exe
> make[2]: Entering directory `/d/_Projects/C++/Objects/ObjectsGUI/Objects'
> g++.exe -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE 
> -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX 
> -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 
> -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN 
> -I'c:/QtSDK/Desktop/Qt/4.7.4/mingw/include/QtCore' 
> -I'c:/QtSDK/Desktop/Qt/4.7.4/mingw/include/QtGui' 
> -I'c:/QtSDK/Desktop/Qt/4.7.4/mingw/include' 
> -I'c:/QtSDK/Desktop/Qt/4.7.4/mingw/include/ActiveQt' -I'.' -I'nbproject' 
> -I'.' -I'c:/QtSDK/Desktop/Qt/4.7.4/mingw/mkspecs/win32-g++' -o 
> build/Debug/MinGW_Qt-Windows/main.o main.cpp
> make[2]: Leaving directory `/d/_Projects/C++/Objects/ObjectsGUI/Objects'
> make[1]: Leaving directory `/d/_Projects/C++/Objects/ObjectsGUI/Objects'
> main.cpp: In function 'int qMain(int, char**)':
> main.cpp:13: error: invalid use of incomplete type 'struct QWidget'
> c:/QtSDK/Desktop/Qt/4.7.4/mingw/include/QtCore/qobject.h:70: error: forward 
> declaration of 'struct QWidget'
> main.cpp:15: error: invalid use of incomplete type 'struct QWidget'
> c:/QtSDK/Desktop/Qt/4.7.4/mingw/include/QtCore/qobject.h:70: error: forward 
> declaration of 'struct QWidget'
> make[2]: *** [build/Debug/MinGW_Qt-Windows/main.o] Error 1
> make[1]: *** [.build-conf] Error 2
> make: *** [.build-impl] Error 2
> 
> 
> BUILD FAILED (exit value 2, total time: 1s)
> 


Please help me!

Ivan






error: invalid use of incomplete type 'struct QWidget'

8Observer8 11/30/2012

error: invalid use of incomplete type 'struct QWidget'

soldatov 11/30/2012

error: invalid use of incomplete type 'struct QWidget'

8Observer8 11/30/2012

Project Features

About this Project

CND was started in November 2009, is owned by Leonid Lenyashin, and has 130 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20140418.2d69abc). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close