PDA

View Full Version : include errors



phil67rpg
12-05-2010, 08:11 PM
I get 102 errors using the following include files.
#include <windows.h>
#include <math.h>
#include <stdlib.h>
#include <GL\glew.h>
#include <GL\gl.h>
#include <GL\glut.h>
#include <GL\GLTools.h>

ugluk
12-06-2010, 12:15 AM
Hmm, if you are a C/C++ noob, try developing on gentoo, Linux, or Freebsd. There is better support for C/C++ development there and it comes out of the box.

The order of includes seems correct, I don't know about GLTools.h, what that might be. Try dropping GLTools.h or glut.h out of the includes and see what happens.

By all means, if you include glut.h, don't include gl.h also. I do it like this in my code:

#include "GL/glew.h"
#include "GL/glut.h"

#ifdef FREEGLUT
# include "GL/freeglut_ext.h"
#endif // FREEGLUT

and it compiles on both linux and windows.

phil67rpg
12-06-2010, 05:53 PM
well I tried what was posted.I still get the following error.
1>------ Build started: Project: imageload, Configuration: Debug Win32 ------
1>Compiling...
1>ImageLoad.c
1>c:\users\owner\desktop\imageload.c(42) : warning C4013: 'gltLoadTGA' undefined; assuming extern returning int
1>c:\users\owner\desktop\imageload.c(42) : warning C4047: '=' : 'GLubyte *' differs in levels of indirection from 'int'
1>Linking...
1>ImageLoad.obj : error LNK2019: unresolved external symbol _gltLoadTGA referenced in function _RenderScene
1>C:\Users\Owner\Documents\Visual Studio 2008\Projects\imageload\Debug\imageload.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://c:\Users\Owner\Documents\Visual Studio 2008\Projects\imageload\imageload\Debug\BuildLog.h tm"
1>imageload - 2 error(s), 2 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

ugluk
12-06-2010, 06:12 PM
Obviously you need a definition of gltLoadTGA() somewhere. Link with appropriate library or .o files.

phil67rpg
12-06-2010, 10:09 PM
do you have any idea what lib I should include .

Alfonse Reinheart
12-06-2010, 10:32 PM
do you have any idea what lib I should include .

Aren't you the one using the library? I'm going back to something Ugluk pointed towards: do you know how to build a C/C++ program? If not, then you need to learn that before learning OpenGL through C/C++.

mhagain
12-07-2010, 04:33 AM
Hmm, if you are a C/C++ noob, try developing on gentoo, Linux, or Freebsd. There is better support for C/C++ development there and it comes out of the box.I'd qualify that by saying that if you're not familiar with those platforms then you're likely going to have even more trouble. Use the tools you know best for the most pain-free experience.

Also that MSVC is genuinely one of the better dev tools avaialble (and has - hands down - the best debugger) so it's a moot point which platform is "best" for supporting C/C++ development.


Aren't you the one using the library? I'm going back to something Ugluk pointed towards: do you know how to build a C/C++ program? If not, then you need to learn that before learning OpenGL through C/C++. Agreed. The errors you're getting are symptomatic of you not having things set up right, so learn how to do that properly first.