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

## Recommended Posts

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

Edited by Josheir

##### Share on other sites
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)

Edited by MrHallows
Fixed formatting

##### Share on other sites

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

Josheir

##### Share on other sites

I opened a new project with just :

glColor3f(0.5, 0.5, 0.5);

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

Edited by Josheir

##### Share on other sites
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?

##### Share on other sites

Please don't use MS OpenGL Ver. 1.1 includes

And also get this if you don't have it.

Your includes should look like this when you have your paths in VS properly configured.

#include <GL/glew.h>
#include <GL/freeglut.h>

Will this solve your problem? Maybe. But this is the horse. Your issue is a cart.

Edited by fleabay

##### Share on other sites

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

##### Share on other sites

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

##### Share on other sites

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

Edited by Josheir

##### Share on other sites

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

Josheir

## Create an account

Register a new account

1. 1
Rutin
42
2. 2
3. 3
4. 4
5. 5

• 9
• 27
• 20
• 9
• 20
• ### Forum Statistics

• Total Topics
633395
• Total Posts
3011651
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!