Quantcast
Channel: Active questions tagged header - Stack Overflow
Viewing all articles
Browse latest Browse all 795

Declare object in header

$
0
0

How can I declare an object without initializing it?

This is my header file

    #include "shader.h"    Class Renderer {        private:        kaarez::graphics::Shader m_terrainShader;    };

And my source file

    #include "Renderer.h"    #include "Shader.h"    Renderer::Renderer() {        //Load terrain shader        m_terrainShader =  kaarez::graphics::Shader("vertex.txt", "fragment.txt");    }

I get the error that theres no appropriate default constructor available for Shader.

Shader is header-only, and it works when I declare it in the main method by kaarez::graphics::Shader terrainShader("vertex.txt", "fragment.txt");

What is wrong?


Viewing all articles
Browse latest Browse all 795

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>