Este é o programa
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <glm/glm.hpp>
using namespace glm;
int main()
{
//Initialise GLFW
glewExperimental = true;
if (!glfwInit())
{
std::cerr << "Failed to initialise GLFW\n";
return -1;
}
//OpenGL Window
glfwWindowHint(GLFW_SAMPLES, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
GLFWWindow* window;
window = glfwCreateWindow(1024, 768, "01", nullptr, nullptr);
if (window == nullptr)
{
std::cerr << "Failed to open GLFW window\n";
glfwTerimate();
return -1;
}
glfwMakeContextCurrent(window);
glewExperimental = true;
if (glewInit() != GLEW_OK)
{
std::cerr << "Failed to initilase GLEW\n";
return -1;
}
}
Comando:
g++ opening_window.cpp -lGL -lglfw3 -lm -lXrandr -lXi -lX11 -lXxf86vm -lpthread
Erro:
opening_window.cpp: In function ‘int main()’:
opening_window.cpp:29:5: error: ‘GLFWWindow’ was not declared in th
is scope
GLFWWindow* window;
^
opening_window.cpp:29:17: error: ‘window’ was not declared in this
scope
GLFWWindow* window;
^
opening_window.cpp:30:48: error: ‘nullptr’ was not declared in this
scope
window = glfwCreateWindow(1024, 768, "01", nullptr, nullptr);
^
opening_window.cpp:34:22: error: ‘glfwTerimate’ was not declared in
this scope
glfwTerimate();
Eu segui estas instruções.