matus-chochlik / oglplus

OGLplus is a collection of open-source, cross-platform libraries which implement an object-oriented facade over the OpenGL® (version 3 and higher) and also OpenAL® (version 1.1) and EGL (version 1.4) C-language APIs. It provides wrappers which automate resource and object management and make the use of these libraries in C++ safer and more convenient.
http://oglplus.org/
Boost Software License 1.0
492 stars 72 forks source link

Lots of compilation errors #107

Closed kanthoney closed 9 years ago

kanthoney commented 9 years ago

I'm trying to compile the program

#include <cassert>
#include <GL/glew.h>
#include <GL/glut.h>
#include <oglplus/all.hpp>

int main()
{
  return 0;
}

and I'm getting loads of compilation errors. These are, broken down by the individual headers:

context.hpp - quite a lot of errors of the form

implement/oglplus/enums/pixel_parameter_type.ipp:39:38: error: 'PackCompressedBlockWidth' is not a member of 'oglplus::enums::PixelParameter'
 struct EnumAssocType<PixelParameter, PixelParameter::PackCompressedBlockWidth>
                                      ^
implement/oglplus/enums/pixel_parameter_type.ipp:39:38: error: 'PackCompressedBlockWidth' is not a member of 'oglplus::enums::PixelParameter'
implement/oglplus/enums/pixel_parameter_type.ipp:39:78: error: template argument 2 is invalid
 struct EnumAssocType<PixelParameter, PixelParameter::PackCompressedBlockWidth>

Looking at the code, it seems that PackCompressedBlockWidth is declared in pixel_parameter_def.ipp, but only if GL_PACK_COMPRESSED_BLOCK_WIDTH is defined, whereas it's defined in pixel_parameter_type.ipp no matter what. So if GL_PACK_COMPRESSED_BLOCK_WIDTH isn't defined, which I guess it isn't on my setup, you get compilation errors. If you surround the definitions with #if defineds the way the declarations are the errors disappear.

texture.hpp

In file included from include/oglplus/fwd.hpp:16:0,
                 from main.cpp:4:
implement/oglplus/texture.ipp: In static member function 'static void oglplus::ObjZeroOps<oglplus::tag::ExplicitSel, oglplus::tag::Texture>::GetImage(oglplus::ObjBindingOps<oglplus::tag::Texture>::Target, GLint, oglplus::enums::PixelDataFormat, const oglplus::OutputData&)':
implement/oglplus/texture.ipp:218:19: error: 'size' was not declared in this scope
  OGLPLUS_FAKE_USE(size);
                   ^
include/oglplus/config/compiler.hpp:231:35: note: in definition of macro 'OGLPLUS_FAKE_USE'
 #define OGLPLUS_FAKE_USE(X) (void)X
                                   ^
implement/oglplus/texture.ipp: In static member function 'static void oglplus::ObjZeroOps<oglplus::tag::ExplicitSel, oglplus::tag::Texture>::GetCompressedImage(oglplus::ObjBindingOps<oglplus::tag::Texture>::Target, GLint, const oglplus::OutputData&)':
implement/oglplus/texture.ipp:258:19: error: 'size' was not declared in this scope
  OGLPLUS_FAKE_USE(size);
                   ^
include/oglplus/config/compiler.hpp:231:35: note: in definition of macro 'OGLPLUS_FAKE_USE'
 #define OGLPLUS_FAKE_USE(X) (void)X
                                   ^

Commenting out the offending OGLPLUS_FAKE_USE(size) lines fixes the problem. Since they're apparently only in there to stop the compiler complaining I'm not sure why they're there.

sampler.hpp

In file included from include/oglplus/sampler.hpp:961:0,
                 from main.cpp:5:
implement/oglplus/sampler.ipp:15:8: error: specializing member 'oglplus::ObjBindingOps<oglplus::tag::Sampler>::_binding' requires 'template<>' syntax
 GLuint ObjBindingOps<tag::Sampler>::
        ^
main.cpp:10:1: error: expected '}' at end of input
 }
 ^

No idea what the "requires template<>" error means, but I guess it's down to the fact the braces are getting imbalanced somewhere.

transform_feedback.hpp

In file included from include/oglplus/transform_feedback.hpp:17:0,
                 from main.cpp:5:
include/oglplus/transform_feedback.hpp: In constructor 'oglplus::TransformFeedbackPauser::TransformFeedbackPauser()':
include/oglplus/glfunc.hpp:53:30: error: '::glPauseTransformFeedback' has not been declared
  ::oglplus::_checked_glfunc(&::gl##FUNCNAME, #FUNCNAME)
                              ^
include/oglplus/transform_feedback.hpp:216:3: note: in expansion of macro 'OGLPLUS_GLFUNC'
   OGLPLUS_GLFUNC(PauseTransformFeedback)();
   ^
include/oglplus/transform_feedback.hpp: In member function 'void oglplus::TransformFeedbackPauser::Resume()':
include/oglplus/glfunc.hpp:53:30: error: '::glResumeTransformFeedback' has not been declared
  ::oglplus::_checked_glfunc(&::gl##FUNCNAME, #FUNCNAME)
                              ^
include/oglplus/transform_feedback.hpp:243:4: note: in expansion of macro 'OGLPLUS_GLFUNC'
    OGLPLUS_GLFUNC(ResumeTransformFeedback)();
    ^
include/oglplus/transform_feedback.hpp: In static member function 'static void oglplus::ObjCommonOps<oglplus::tag::TransformFeedback>::Pause()':
include/oglplus/glfunc.hpp:53:30: error: '::glPauseTransformFeedback' has not been declared
  ::oglplus::_checked_glfunc(&::gl##FUNCNAME, #FUNCNAME)
                              ^
include/oglplus/transform_feedback.hpp:404:3: note: in expansion of macro 'OGLPLUS_GLFUNC'
   OGLPLUS_GLFUNC(PauseTransformFeedback)();
   ^
include/oglplus/transform_feedback.hpp: In static member function 'static void oglplus::ObjCommonOps<oglplus::tag::TransformFeedback>::Resume()':
include/oglplus/glfunc.hpp:53:30: error: '::glResumeTransformFeedback' has not been declared
  ::oglplus::_checked_glfunc(&::gl##FUNCNAME, #FUNCNAME)
                              ^
include/oglplus/transform_feedback.hpp:420:3: note: in expansion of macro 'OGLPLUS_GLFUNC'
   OGLPLUS_GLFUNC(ResumeTransformFeedback)();

Not sure what this one's about.

program.hpp

In file included from include/oglplus/detail/program.hpp:265:0,
                 from include/oglplus/program_resource.hpp:21,
                 from include/oglplus/program.hpp:24,
                 from main.cpp:5:
implement/oglplus/detail/program.ipp: In constructor 'oglplus::aux::TransformFeedbackVaryingInfo::TransformFeedbackVaryingInfo(oglplus::aux::ProgramInterfaceContext&, GLuint)':
implement/oglplus/detail/program.ipp:196:1: error: invalid conversion from 'void (*)(unsigned int, unsigned int, int*)' to 'void (*)(GLuint, GLuint, GLsizei, GLsizei*, GLint*, GLenum*, GLchar*) {aka void (*)(unsigned int, unsigned int, int, int*, int*, unsigned int*, char*)}' [-fpermissive]
 )
 ^
implement/oglplus/detail/program.ipp:28:1: note: initializing argument 3 of 'oglplus::aux::ActiveVariableInfo::ActiveVariableInfo(oglplus::aux::ProgramInterfaceContext&, GLuint, void (*)(GLuint, GLuint, GLsizei, GLsizei*, GLint*, GLenum*, GLchar*))'
 ActiveVariableInfo::ActiveVariableInfo(
 ^

Don't know what this one's about either. Sorry about the huge bug report!

kanthoney commented 9 years ago

Thanks for that. I was getting other compilation errors but it turned out an upgrade to GLEW fixed those.

matus-chochlik commented 9 years ago

NP, glad to hear that it works for you.