Sunday, July 6th 2008, 3:47pm UTC+1

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Wednesday, March 26th 2008, 12:12pm

[c++ codeblock]`uint' does not name a type WHY????

hi...i have a problem...when i compile my prog the compiler give a error:

table.cpp:19: error: `uint' does not name a type
table.cpp:42: error: `qt_meta_data_mytable' was not declared in this scope


i don't understand why there is this error....uint is a type of c++!!!maybe i don't include any lib????bho i don't know..please help me
  • Go to the top of the page

SiRuS

Beginner

Posts: 8

Location: none

Occupation: none

2

Wednesday, March 26th 2008, 12:22pm

RE: [c++ codeblock]`uint' does not name a type WHY????

code -> show();

and check u macros

#ifndef _HEADER_NAME_H =)
  • Go to the top of the page

3

Wednesday, March 26th 2008, 12:35pm

RE: [c++ codeblock]`uint' does not name a type WHY????

was ok!!!!
there is
#ifndef TABLEUI_H
... now i post te code:
-------------------
main.cpp:
--------------------
#include <qapplication.h>
#include "table.h"

int main(int argc, char **argv)
{
QApplication app(argc, argv);
table *pr= new table();
pr->show();

return app.exec();
}

-----------------
table.h
------------------
#include "tableUI.h"



class mytable : public QWidget , protected Ui::table
{
Q_OBJECT

protected:

mytable* obj;

public:
mytable(QObject *parent = 0)
{
this->obj = NULL;
setupUi(this);

connect(w_Btn_Add, SIGNAL(clicked()), this, SLOT(on_Btn_Add()));
connect(w_Btn_Canc, SIGNAL(clicked()), this, SLOT(on_Btn_Canc()));
}

~mytable(){}
private slots:
void on_Btn_Add(){}
void on_Btn_Canc(){}

}

-------------------------
table.cpp
-----------------------


#include "table.h"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'table.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 59
#error "This file was generated using the moc from 4.3.1. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif

static const uint qt_meta_data_mytable[] = {

// content:
1, // revision
0, // classname
0, 0, // classinfo
2, 10, // methods
0, 0, // properties
0, 0, // enums/sets

// slots: signature, parameters, type, tag, flags
9, 8, 8, 8, 0x08,
22, 8, 8, 8, 0x08,

0 // eod
};

static const char qt_meta_stringdata_mytable[] = {
"mytable\0\0on_Btn_Add()\0on_Btn_Canc()\0"
};

const QMetaObject mytable::staticMetaObject = {
{ &QWidget::staticMetaObject, qt_meta_stringdata_mytable,
qt_meta_data_mytable, 0 }
};

const QMetaObject *mytable::metaObject() const
{
return &staticMetaObject;
}

void *mytable::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_mytable))
return static_cast<void*>(const_cast< mytable*>(this));
if (!strcmp(_clname, "Ui::table"))
return static_cast< Ui::table*>(const_cast< mytable*>(this));
return QWidget::qt_metacast(_clname);
}

int mytable::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QWidget::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
switch (_id) {
case 0: on_Btn_Add(); break;
case 1: on_Btn_Canc(); break;
}
_id -= 2;
}
return _id;
}

----------------
tableUI.h
------------------

#ifndef TABLEUI_H
#define TABLEUI_H

#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QGridLayout>
#include <QtGui/QPushButton>
#include <QtGui/QSpacerItem>
#include <QtGui/QTableWidget>
#include <QtGui/QWidget>

class Ui_table
{
public:
QTableWidget *tableWidget;
QWidget *layoutWidget;
QGridLayout *gridLayout;
QPushButton *w_Btn_Add;
QSpacerItem *spacerItem;
QPushButton *w_Btn_Canc;

void setupUi(QWidget *table)
{
if (table->objectName().isEmpty())
table->setObjectName(QString::fromUtf8("table"));
table->resize(531, 27 ;
tableWidget = new QTableWidget(table);
tableWidget->setObjectName(QString::fromUtf8("tableWidget"));
tableWidget->setGeometry(QRect(0, 0, 521, 231));
layoutWidget = new QWidget(table);
layoutWidget->setObjectName(QString::fromUtf8("layoutWidget"));
layoutWidget->setGeometry(QRect(0, 240, 525, 25));
gridLayout = new QGridLayout(layoutWidget);
gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
gridLayout->setContentsMargins(0, 0, 0, 0);
w_Btn_Add = new QPushButton(layoutWidget);
w_Btn_Add->setObjectName(QString::fromUtf8("w_Btn_Add"));

gridLayout->addWidget(w_Btn_Add, 0, 0, 1, 1);

spacerItem = new QSpacerItem(361, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);

gridLayout->addItem(spacerItem, 0, 1, 1, 1);

w_Btn_Canc = new QPushButton(layoutWidget);
w_Btn_Canc->setObjectName(QString::fromUtf8("w_Btn_Canc"));

gridLayout->addWidget(w_Btn_Canc, 0, 2, 1, 1);


retranslateUi(table);

QMetaObject::connectSlotsByName(table);
} // setupUi

void retranslateUi(QWidget *table)
{
table->setWindowTitle(QApplication::translate("table", "Form", 0, QApplication::UnicodeUTF );
if (tableWidget->columnCount() < 5)
tableWidget->setColumnCount(5);

QTableWidgetItem *__colItem = new QTableWidgetItem();
__colItem->setText(QApplication::translate("table", "ID", 0, QApplication::UnicodeUTF );
tableWidget->setHorizontalHeaderItem(0, __colItem);

QTableWidgetItem *__colItem1 = new QTableWidgetItem();
__colItem1->setText(QApplication::translate("table", "X", 0, QApplication::UnicodeUTF );
tableWidget->setHorizontalHeaderItem(1, __colItem1);

QTableWidgetItem *__colItem2 = new QTableWidgetItem();
__colItem2->setText(QApplication::translate("table", "Y", 0, QApplication::UnicodeUTF );
tableWidget->setHorizontalHeaderItem(2, __colItem2);

QTableWidgetItem *__colItem3 = new QTableWidgetItem();
__colItem3->setText(QApplication::translate("table", "PWR", 0, QApplication::UnicodeUTF );
tableWidget->setHorizontalHeaderItem(3, __colItem3);

QTableWidgetItem *__colItem4 = new QTableWidgetItem();
__colItem4->setText(QApplication::translate("table", "CH", 0, QApplication::UnicodeUTF );
tableWidget->setHorizontalHeaderItem(4, __colItem4);
if (tableWidget->rowCount() < 1)
tableWidget->setRowCount(1);

QTableWidgetItem *__rowItem = new QTableWidgetItem();
__rowItem->setText(QApplication::translate("table", "0", 0, QApplication::UnicodeUTF );
tableWidget->setVerticalHeaderItem(0, __rowItem);

bool __sortingEnabled = tableWidget->isSortingEnabled();
tableWidget->setSortingEnabled(false);

QTableWidgetItem *__item = new QTableWidgetItem();
__item->setText(QApplication::translate("table", "0", 0, QApplication::UnicodeUTF );
tableWidget->setItem(0, 0, __item);

QTableWidgetItem *__item1 = new QTableWidgetItem();
__item1->setText(QApplication::translate("table", "0.0", 0, QApplication::UnicodeUTF );
tableWidget->setItem(0, 1, __item1);

QTableWidgetItem *__item2 = new QTableWidgetItem();
__item2->setText(QApplication::translate("table", "0.0", 0, QApplication::UnicodeUTF );
tableWidget->setItem(0, 2, __item2);

QTableWidgetItem *__item3 = new QTableWidgetItem();
__item3->setText(QApplication::translate("table", "0.0", 0, QApplication::UnicodeUTF );
tableWidget->setItem(0, 3, __item3);

QTableWidgetItem *__item4 = new QTableWidgetItem();
__item4->setText(QApplication::translate("table", "0", 0, QApplication::UnicodeUTF );
tableWidget->setItem(0, 4, __item4);

tableWidget->setSortingEnabled(__sortingEnabled);

w_Btn_Add->setText(QApplication::translate("table", "Add", 0, QApplication::UnicodeUTF );
w_Btn_Canc->setText(QApplication::translate("table", "Cancel", 0, QApplication::UnicodeUTF );
Q_UNUSED(table);
} // retranslateUi

};

namespace Ui {
class table: public Ui_table {};
} // namespace Ui

#endif // TABLEUI_H




the error is in table.cpp....
at the line:
static const uint qt_meta_data_mytable[]

the error is: `uint' does not name a type
  • Go to the top of the page

4

Thursday, March 27th 2008, 10:04pm

The problem is there is no standard type as uint.

There is int, and unsigned int.

Things like uint and UINT are typedefs.
I don't think Mingw headers have uint typedef anywhere.

I think Microsoft headers have a UINT typedef somewhere.
  • Go to the top of the page

5

Thursday, March 27th 2008, 10:25pm

yes but another program whith the same settings and option work rigth!!!!!i don't understand why!!!
  • Go to the top of the page

6

Friday, March 28th 2008, 12:51am

Edited out

This post has been edited 1 times, last edit by "guestgulkan" (Mar 28th 2008, 12:55am)

  • Go to the top of the page

7

Friday, March 28th 2008, 1:04am

There should be a semicolon ; at the end of the class definition of in table.h like this
-----------------
table.h
------------------
#include "tableUI.h"



class mytable : public QWidget , protected Ui::table
{
Q_OBJECT

protected:

mytable* obj;

public:
mytable(QObject *parent = 0)
{
this->obj = NULL;
setupUi(this);

connect(w_Btn_Add, SIGNAL(clicked()), this, SLOT(on_Btn_Add()));
connect(w_Btn_Canc, SIGNAL(clicked()), this, SLOT(on_Btn_Canc()));
}

~mytable(){}
private slots:
void on_Btn_Add(){}
void on_Btn_Canc(){}

}
;

This post has been edited 1 times, last edit by "guestgulkan" (Mar 28th 2008, 1:09am)

  • Go to the top of the page

8

Friday, March 28th 2008, 10:54am

ok i put the ; at the end of the file table.h..the previous error is cancelled but there is another error at the definitio of new object rable at file mainTable.cpp.
out of compiler:

mainTable.cpp:7: error: `table' undeclared (first use this function)
mainTable.cpp:7: error: (Each undeclared identifier is reported only once for each function it appears in.)
mainTable.cpp:7: error: `pr' undeclared (first use this function)
mainTable.cpp:7: error: `table' has not been declared
  • Go to the top of the page

9

Friday, March 28th 2008, 9:43pm

Is it possible for you to put your files in a zip or archive and attach it - I think that maybe a quicker way to resolve your problem.
  • Go to the top of the page

Rate this thread