Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6575701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:25:13+00:00 2026-05-25T15:25:13+00:00

I have a very strange error in my Qt project. Here is the code,

  • 0

I have a very strange error in my Qt project. Here is the code, the main_window.h:

#include <QtGui>
#include <QtSql>

class main_window : public QTabWidget
{
    Q_OBJECT

    /// @name List Widgets
private:
    QListWidget*    m_documents_list;
....

and here is main_window.cpp:

...
void main_window::create_documents_widget()
{
    m_documents = new QWidget(this);
    m_documents_list = new QListWidget(m_documents);
}
...

The problem that I can’t understand is in QListView, I’m not using it in my project. There is only QListWidget, but when I’m trying to build the project the following errors occur:

qlistview.h:194: error: ISO C++ forbids declaration of ‘QListView’ with no type

qlistview.h:194: error: expected ‘,’ or ‘…’ before ‘&’ token

Also the following strange errors:

qlistwidget.h:308: error: no ‘void QListWidget::removeItemWidget(QListWidgetItem)’ member function declared in class ‘QListWidget’*

qlistwidget.h:311: error: no ‘void QListWidget::addItem(QListWidgetItem)’ member function declared in class ‘QListWidget’*

qlistwidget.h:314: error: no ‘QListWidgetItem QListWidget::itemAt(int, int) const’ member function declared in class ‘QListWidget’*

etc.

Thanks in advance.

UPD: I’m using QtCreator 2.2.1 on Windows 7.

UPD2: Qt version is 4.7.1.

UPD3: The complete output

In file included from c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/QtGui:68,
                 from ..\my_project\/main_window.h:4,
                 from ..\my_project\main.cpp:2:
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistview.h:194: error: ISO C++ forbids declaration of 'QListView' with no type
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistview.h:194: error: expected ',' or '...' before '&' token
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistview.h:194: error: ISO C++ forbids declaration of 'QListView' with no type
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistview.h:194: error: ISO C++ forbids declaration of 'QListView' with no type
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistview.h:194: error: expected ';' before '&' token
In file included from c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/QtGui:69,
                 from ..\my_project\/main_window.h:4,
                 from ..\my_project\main.cpp:2:
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h:202: error: redefinition of 'class QListWidget'
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistview.h:58: error: previous definition of 'class QListWidget'
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h:308: error: no 'void QListWidget::removeItemWidget(QListWidgetItem*)' member function declared in class 'QListWidget'
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h:311: error: no 'void QListWidget::addItem(QListWidgetItem*)' member function declared in class 'QListWidget'
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h:314: error: no 'QListWidgetItem* QListWidget::itemAt(int, int) const' member function declared in class 'QListWidget'
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h: In member function 'void QListWidgetItem::setSelected(bool)':
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h:318: error: 'class QListWidget' has no member named 'setItemSelected'
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h: In member function 'bool QListWidgetItem::isSelected() const':
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h:321: error: 'class QListWidget' has no member named 'isItemSelected'
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h: In member function 'void QListWidgetItem::setHidden(bool)':
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h:324: error: 'class QListWidget' has no member named 'setItemHidden'
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h: In member function 'bool QListWidgetItem::isHidden() const':
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h:327: error: 'class QListWidget' has no member named 'isItemHidden'
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:25:14+00:00Added an answer on May 25, 2026 at 3:25 pm

    Firstly – you should also mention qt version, as in this case that’s most important.

    This seems like some weird quirk of compiler or qt – my recomendation would be first to create simplest program where problem occurs. If it shows also in program like

    #include <QtGui/QListWidget>
    int main(int argc, char* argv[]){
        QListWidget* w = 0;
    }
    

    then it is some problem with qt headers of compiler – then answer cannot be provided from data provided. If it works, then try to slowly add other elements of your code to this simple file – most likely at some point you will get the same error again – then you will know that last added piece of code is guilty. Some additional thinking might be required to figure out how to remove problem once located.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A very strange error: if I add some specific code to my project, any
I have an very strange error: when I want to use the SocialServer::Client class
I have very strange error I can't understand. I started a new project throw
it is very strange, because this error doesn't happen all the time... I have
I have a very strange behavior with Request.Form . Here are two IIS 7
I have a very strange bug, which I believe is caused by some code
I have a very strange problem and the following code wont compile: #ifndef MYWINDOW_HPP_INCLUDED
I have this very strange issue with my MVC 2 project. Often times, I'll
Very strange error, i have a field on an MVC View: <%: Html.CheckBox(Reportable, ViewData[Reportable])%>
I'm experiencing a very strange (and annoying) linker error on my project. Say for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.