Hi, I'm writing a little application using Qt, and OGL on Vista x64. The application currently works, however I'm trying to learn more about C++ and this is my first project using Classes.
I'm trying to make a Public function called "DevIL" i declare it in under Public in my GLMain class header:
GLMain.h
Then implement the function in my GLMain Class.Code:class GLMain : public QGLWidget { Q_OBJECT public: GLMain(QWidget *parent = 0); void DevIL();
GLMain.cpp
I then try and call "DevIL" or "DevIL();" or "GLMain DevIL;" from within my "open" function in "MainWindow.cpp" and i get "undeclared identifier".Code:void GLMain::DevIL() { doSomething(); }
Code:void MainWindow::open() { QString fileName = QFileDialog::getOpenFileName(this); if (!fileName.isEmpty()) DevIL; ilLoadImage(qPrintable(fileName)); }
Why can i only call it from within my GLMain class, and not from MainWindow. I thought public functions can be called from any others in my program. The below call of "DevIL();" works fine from my GLMain:InitializeGL function.
So how do i do this, Do i have to instance my class and if so any Syntax on how, as its driving me around in circles...Code:void GLMain::initializeGL() { DevIL(); }
Cheers!