This question has already been answered:
Created the simplest scene in opengl (everything works). I decided to push it into the class began to jump error
undefined reference to `WinMain @ 16 '
Here is the code:
main.h
#ifndef MAIN_H #define MAIN_H #include <QCoreApplication> #include <QTextStream> #include <QTextCodec> #include <cstdio> //Π±Π΅ΡΠΏΠ΅ΡΠΈΠ²Π°Π΅Ρ Π²ΡΠΏΠΎΠ»Π½Π΅Π½ΠΈΠ΅ ΠΎΠΏΠ΅ΡΠ°ΡΠΈΠΉ Π²Π²ΠΎΠ΄Π°/Π²ΡΠ²ΠΎΠ΄ (printf) #include <glew.h> // ΠΎΠ±ΡΠ·Π°ΡΠ΅Π»ΡΠ½ΠΎ ΠΏΠ΅ΡΠ²Π°Ρ Π³ΡΠ°ΡΠΈΡ Π±ΠΈΠ±Π»ΠΈΠΎΡΠ΅ΠΊΠ° #include <GL/gl.h> #include <glfw3.h> // ΡΡΡΠΈΡΡ QTextStream outStream(stdout); class MainWindow { //Π³Π»ΠΎΠ±Π°Π»ΡΠ½ΡΠ΅ ΠΏΠ΅ΡΠ΅ΠΌΠ΅Π½Π½ΡΠ΅ const char* APP_TITLE; //const int glfwWindowHint(); const int gWindowWidth = 800; const int gWindowHeight = 600; GLFWwindow* gWindow; public: int start(); void glfw_onFramebufferSize(GLFWwindow* window, int width, int height); bool initOpenGL(); private: }; #endif // MAIN_H main.cpp
#include "main.h" //int main(int argc, char *argv[]) int MainWindow::start() { APP_TITLE = "Π¨Π°ΡΠ΅ΡΠΊΠΈ"; gWindow = NULL; // QCoreApplication a(argc, argv); // return a.exec(); outStream.setCodec(QTextCodec::codecForName("cp866")); if (!initOpenGL()) { // An error occured outStream << QString("GLFW ΠΈΠ½ΠΈΡΠΈΠ°Π»ΠΈΠ·Π°ΡΠΈΡ ΠΏΡΠΎΠ²Π°Π»ΠΈΠ»Π°ΡΡ") << flush; return -1; } while (!glfwWindowShouldClose(gWindow)) { // Poll for and process events glfwPollEvents(); outStream <<QString("%1").arg(glfwGetTime()); glfwSwapBuffers(gWindow); } glfwTerminate(); return 0; } //----------------------------------------------------------------------------- // Initialize GLFW and OpenGL //----------------------------------------------------------------------------- bool MainWindow::initOpenGL() { //ΠΈΠ½ΠΈΡΠΈΠ°Π»ΠΈΠ·Π°ΡΠΈΡ GLFW if(!glfwInit()) { // outStream << QString("GLFW ΠΈΠ½ΠΈΡΠΈΠ°Π»ΠΈΠ·Π°ΡΠΈΡ ΠΏΡΠΎΠ²Π°Π»ΠΈΠ»Π°ΡΡ") << flush; return false; } glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); // glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_OPENGL_ANY_PROFILE, GLFW_OPENGL_CORE_PROFILE); // ΠΏΡΠΎΠ²Π΅Ρ Π»ΠΈΠ±ΠΎ ΡΠ°Π·ΠΊΠΎΠΌΠ΅Π½ΡΠΈ Π²Π΅ΡΡ
/* forward compatible with newer versions of OpenGL as they become available but not backward compatible (it will not run on devices that do not support OpenGL 3.3 */ glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // Create an OpenGL 3.3 core, forward compatible context window gWindow = glfwCreateWindow(gWindowWidth, gWindowHeight, APP_TITLE, NULL, NULL); if(gWindow == NULL) { outStream << QString("ΠΎΡΠ±ΠΈΠΊΠ° ΡΠΎΠ·Π΄Π°Π½ΠΈΡ GLFW ΠΎΠΊΠ½Π°") << flush; glfwTerminate(); return false; } // Make the window's context the current one glfwMakeContextCurrent(gWindow); // INitialize GLEW glewExperimental = GL_TRUE; if(glewInit() != GLEW_OK) { outStream << QString("GLEW ΠΈΠ½ΠΈΡΠΈΠ°Π»ΠΈΠ·Π°ΡΠΈΡ ΠΏΡΠΎΠ²Π°Π»ΠΈΠ»Π°ΡΡ") << flush; return false; } return true; } //----------------------------------------------------------------------------- // Is called when the window is resized //----------------------------------------------------------------------------- void MainWindow::glfw_onFramebufferSize(GLFWwindow* window, int width, int height) { glViewport(0, 0, width, height); } What am I doing wrong ?? Why jumped error ??

