Failing to Define Like a Header File isn't Specified.

Started by
9 comments, last by Josheir 5 years, 6 months ago

I am trying to use : OpenGL and draw some simple text quickly. However I cannot get the top two commands to define. 

 


glColor3f(rgb.r, rgb.g, rgb.b); 
glRasterPos2f(x, y);

glutBitmapString(font, string);

I tried this :


#include <C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1A/Include/gl/GL.h>

May I have some help please.  The last command which is with glut is fine.  Apparently, the problem is not with GLUT or FreeGlut, but with Visual Studio headers.  I am using Visual Studio 2017, C++.

 

Thank you,

Josheir

Advertisement
58 minutes ago, Josheir said:

I am trying to use : OpenGL and draw some simple text quickly. However I cannot get the top two commands to define. 

 



glColor3f(rgb.r, rgb.g, rgb.b); 
glRasterPos2f(x, y);

glutBitmapString(font, string);

I tried this :



#include <C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1A/Include/gl/GL.h>

May I have some help please.  The last command which is with glut is fine.  Apparently, the problem is not with GLUT or FreeGlut, but with Visual Studio headers.  I am using Visual Studio 2017, C++.

 

Thank you,

Josheir

All you need to do is specify the .lib files in the linker by doing the following in Visual Studio:
    • Open the Project menu, then select [project name] Properties... -> Linker -> Input
    • Click the dropdown arrow in the Additional Dependencies field and click <Edit...>
    • Add opengl32.lib and glu32.lib to the list (see the included screenshot)
    • Click OK then Apply -> OK
    • Add #include <gl/GL.h> and #include <gl/GLU.h> to the necessary file(s)
    • Rebuild the Solution (Ctrl+Alt+F7)

devenv_2018-10-12_16-36-37.png

"Tell me and I forget. Teach me and I remember. Involve me and I learn." - Benjamin Franklin

Thank you for the reply, MrHallows.  However all that is already done.  I'm stumped.

Josheir

I opened a new project with just :  


glColor3f(0.5, 0.5, 0.5);

in main().  Didn't work either, perplexed!

1 hour ago, Josheir said:

Thank you for the reply, MrHallows.  However all that is already done.  I'm stumped.

Josheir

Hmm.. That is certainly odd.

20 minutes ago, Josheir said:

I opened a new project with just :  



glColor3f(0.5, 0.5, 0.5);

in main().  Didn't work either, perplexed!

I assume you set up the new project in the same manner. A couple of questions:

    1) Are you getting any build/runtime errors at all or it's just not doing what it should be?
    2) What do your configuration settings look like?

"Tell me and I forget. Teach me and I remember. Involve me and I learn." - Benjamin Franklin

Also, would you mind pasting all of the code (at least from main.cpp), please?

"Tell me and I forget. Teach me and I remember. Involve me and I learn." - Benjamin Franklin

Well, I added the include to glew.h and half my problems were solved.  glColor3f(0.1f,0.1f,0.1f) is now working.  Maybe this sheds light on the red squiggly beneath glRasterPos3(…?

Thank you so much,

Josheir

 

Okay it works...thanks everyone.  Needed glew.h, that's all!

Josheir

So, how is it recommended, fleabay, for organizing the various libs and headers that are used repeatedly?  Are we putting them all in a folder for libs and a folder for headers with subfolders?  Or, are we putting them all in the directory of each project, too?

Thanks again.

Josheir

 

The reason I ask, is two different headers are in the same sub folder, there!  So, what do you suggest?

Josheir

This topic is closed to new replies.

Advertisement