C++ -- candidate expects 1 argument, 0 on class definition -


i have used c++ , opengl while have never realy dwelled classes. trying create block class voxel game compiler giving me error

block.h:13:7: note: candidate expects 1 argument, 0 provided

line 13 line create class. here block header file:

#ifndef block_h #define block_h  #include <gl/glew.h> #include <glm/glm.hpp> #include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/type_ptr.hpp> #include "shader.h" #include "camera.h"  using namespace glm;  class block{ public:     void render(camera cam);     glm::vec3 position;     block(glm::vec3 position);   private:     void createmesh();     gluint vao, vbo;     shader shader; };  #endif 

the complete error:

world.cpp: in constructor ‘world::world(glfwwindow*)’: world.cpp:3:32: error: no matching function call ‘block::block()’  world::world(glfwwindow* window)                                 ^ world.cpp:3:32: note: candidates are: in file included world.h:9:0,                  world.cpp:1: block.h:17:2: note: block::block(glm::vec3)   block(glm::vec3 position);    ^ block.h:17:2: note:   candidate expects 1 argument, 0 provided block.h:13:7: note: block::block(const block&)  class block{        ^ block.h:13:7: note:   candidate expects 1 argument, 0 provided 

i receiving many other similar compiler errors, here output:
http://pastie.org/10691691

---edit--- ok, have shortend error down bit. here updated error log: http://pastie.org/10691707

i saw error saying shader not have default constructor, i.e shader::shader(). error, constructor block class going need construct in member initializer list.

for example

block::block(glm::vec3 position) :  m_shader( "needed shader args" ) { } 

it further looked attempting construct 1 of blocks somewhere, in world class?. there complaining lack of default constructor block. if want default constructor, must define 1 in block class definition. or need initialize block class in world class's member initializer list, above example shader.

as compiler suggests, use in class member initializers, you'd need turn on c++11 support that.


Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -