-
April 18th, 2011, 10:28 AM
#1
ISO C++ forbids declaration of..
Hi, i'm doing an application with Qt/OpenGL and i have some problems with auxiliar functions to open files in Qt.
I receive these errors:
ISO C++ forbids declaration of "open" with no type
ISO C++ forbids declaration of "loadFile" with no type
-
April 18th, 2011, 10:30 AM
#2
Re: ISO C++ forbids declaration of..
Sorry, error typing, i've not finished the text already ^^
You can see here the code of each function:
MenuPrincipal:pen()
{
QString fileName = QFileDialog::getOpenFileName(this);
if (!fileName.isEmpty())
loadFile(fileName);
return 0;
}
MenuPrincipal::loadFile(const QString &fileName)
{
QFile file(fileName);
if (!file.open(QFile::ReadOnly | QFile::Text)) {
QMessageBox::warning(this, tr("Application"),
tr("Cannot read file %1:\n%2.")
.arg(fileName)
.arg(file.errorString()));
return 0;
}
QApplication::setOverrideCursor(Qt::WaitCursor);
QApplication::restoreOverrideCursor();
setCurrentFile(fileName);
return 0;
}
and the code in the header:
private slots:
int open();
private:
int loadFile(const QString &fileName);
-
April 19th, 2011, 12:02 PM
#3
Re: ISO C++ forbids declaration of..
-
April 19th, 2011, 12:17 PM
#4
Re: ISO C++ forbids declaration of..
Just add the int that you have in your header file declarations to the function header introducing the function implementation as well. That's the simple truth this error message is telling you.
Please use code tags when posting code.
I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.
This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.
-
April 19th, 2011, 12:46 PM
#5
Re: ISO C++ forbids declaration of..
Seriously, you can't put this
ISO C++ forbids declaration of "loadFile" with no type
and this
MenuPrincipal::loadFile(const QString &fileName)
together and figure out what you did wrong?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|