При вызове класса и метода ошибка - Main.cpp:4:13: error: expected unqualified-id before '.' token 4 |
Код:
Application.cpp
Application :: Init()
{
Window.ShowWindow();
}
Application.hpp:
#include "Window.hpp"
class Application {
public:
bool Init();
};
Window.hpp:
#include <GLFW/glfw3.h>
extern bool Start_Successed = NULL;
class Window {
public:
bool ShowWindow(unsigned int width = 800, unsigned int height = 600,
const char*title = "Welcome!");
};
Window.cpp:
#include "Window.hpp"
Window :: ShowWindow(unsigned int width = 800, unsigned int height = 600, const char*
title = "Welcome!") {
bool Start_Successed = NULL;
GLFWwindow* window;
/* Initialize the library */
if (glfwInit())
Start_Successed = true;
/* Create a windowed mode window and its OpenGL context */
window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
if (window)
{
glfwTerminate();
Start_Successed = true;
}
/* Make the window's context current */
glfwMakeContextCurrent(window);
/* Loop until the user closes the window */
while (!glfwWindowShouldClose(window))
{
/* Render here */
glClear(GL_COLOR_BUFFER_BIT);
/* Swap front and back buffers */
glfwSwapBuffers(window);
/* Poll for and process events */
glfwPollEvents();
}
glfwTerminate();
return Start_Successed;
}
Main.cpp:
#include "Application.hpp"
int main(void) {
Application().Init();
}