Creating C++ class instances globally within my main file -
I have a program with some classes for OpenGL stuff: windows, programs, etc.
I would like the example of windows and programmable sections that use to be main for the main file in my main file, I was doing it for a while with the window like this
// outside main window ("test", // heading 1366, // width 768, // height);
Then I can use this example in the rest of the main file eg.
// within main () .create (); Window.refresh ();
etc.
Now when I try to make a global example of the program, I do it like this:
// just below the window, still main () Program program (); //
There is no logic for the program, then when I try to use it in my main function like this:
program. AddShader (GL_VERTEX_SHADER, "vertex_shader_source.glsl");
I get an error: The request for member 'add-ons' in the 'program', which
requests of non-square type 'program' It seems as if the compiler thinks that my initiality of the first example of main () is a function rather than that, so it thinks that I try to call methods on that function I am doing what is clearly not working I can not do this work How does it work the way it does for the window, the important difference can be that the window can work and what the program is not:
- The manufacturer's logic for the window and Does not program.
- I have other examples of the main () program apart from this global one, of course they have different names but can still cause some problems?
use
program program;
instead of
programmers ();
Without the parameters, you do not need to use feet for the constructor. Actually, the second construction is defined as the Function Manifestation ( program
function without returned parameters).
Comments
Post a Comment