c++ - 'GLEWContext does not name a type' error on ubuntu -
i trying port glew_mx project windows ubuntu errors because of glewcontext being undefined.
error: ‘glewcontext’ not name type
i know dont need glewcontext on linux nevertheless have define
glewcontext* glewgetcontext();
in order compile project. created global glewcontext , return in glewgetcontext.
window.h code looks this:
#pragma once #define glew_mx #define glew_static #include "gl/glew.h" #include "glfw/glfw3.h" #define glm_swizzle #include "glm/glm.hpp" #include "glm/ext.hpp" #ifdef _win32 #define context_prefix window #else #define context_prefix #endif namespace window { class window { public: window() {} ~window() {} //... #ifdef _win32 static void makecontextcurrent(window* window_handle); #endif static window* createwindow(int win_width, int win_height, const std::string& title, glfwmonitor* monitor, window* share); glfwwindow* window; #ifdef _win32 glewcontext* glew_context; #endif //... private: //... }; glewcontext* glewgetcontext(); #ifdef _win32 //... #else glewcontext* glew_context; #endif }
and code in window.cpp looks this:
#ifdef _win32 glewcontext* window::glewgetcontext() { //... } #else glewcontext* window::glewgetcontext() { return glew_context; } #endif
the error occurs while compiling last 2 lines in window.h many
it seems compiler compiles window
class , gets glewcontext* glew_context
line. glewcontext
may not defined, forward declaration might helpful.
since porting windows ubuntu have sure #pragma
supported compiler. may change include guard
#ifndef window_h #define window_h // code here #endif
Comments
Post a Comment