A little help, please...for the new guy

Started by
15 comments, last by obi-wan shinobi 21 years ago
Hello! I''m interested in learning a little about programming in either DirectX or OpenGL, so recently I''ve been looking up tutorials on several websites and have found a couple of year-old pdf documents. I''ve downloaded some source code for beginning OpenGL tutorials, but when I try to compile and execute the code on my system in either Dev C++ or VC++ 6.0, I get various errors like "parse error", etc. I have yet to unzip the DirectX 9 sdk that I''ve downloaded, and most likely, I''m going to put that somewhere other than the C: drive on my system. I''ve successfully compiled and run OpenGL source code on other systems, but on mine, I get compiler errors. How can I tell exactly what files I need in what folders to get OpenGL or the DirectX sdk to work on my system. I''ve checked the "GL" folder in the C++ directory on my system, and it has gl.h, glu.h, and glaux.h, plus I manually added glut.h, glut32.dll, and glut.lib later on. What exactly do I need to have in terms of runtimes or whatever that''s called so the same codes that run on other systems with C++ will run on mine without errors and such? If anyone wants to e-mail me with a response or point me to a site that can clearly answer my questions, let me know in your posts...
Advertisement
first thing i recommend is to forget about directx for the moment and concentrate on openGL (imho its a lot easier, especially when combined with GLUT)


what are your compilation errors dood?
make sure you are adding the right libraries Opengl32.lib(?) to your compilers linker. though if its compilation error, then it sounds like it can''t find the necessary header files.

i can only point you to nehe for help. it has a lot of good beginner tutorials on gl (including setting up various compilers to use it).

good luck

This room is green
I get errors like "unresolved externals" in VC++. I''ve already tried the first 2 of NeHe''s tutorials, and I get 15 or 16 of those errors, which the compiler doesn''t point out to me when I double click on the message. I think I had found a working tutorial once, but I forgot where I found it and I don''t think it''s on my system anymore. Would it be better to buy a book from Amazon.com or something? I''ve tried searching on yahoo, etc. for how to get started with OpenGL/DirectX, but I haven''t found a good site for it yet...
That usually means you are not linking in a required library or you are not including a necessary header file. If you list exactly what the undefined externals are, i''m sure someone on this forum could tell you what library that function(or whatever) is in.
If the "unresolved externals" are referring to functions you wrote, you screwed up somewhere in your code. If they''re not referring to functions you made then you need to add libraries to your project. Probably opengl32.lib and possibly some others. Which functions exactly are unresolved?
This is the list of unresolved externals. Keep in mind that I have not altered any of the libraries or any of NeHe''s source code...

Lesson1.obj : error LNK2001: unresolved external symbol _gluPerspective@32
Lesson1.obj : error LNK2001: unresolved external symbol __imp__glLoadIdentity@0
Lesson1.obj : error LNK2001: unresolved external symbol __imp__glMatrixMode@4
Lesson1.obj : error LNK2001: unresolved external symbol __imp__glViewport@16
Lesson1.obj : error LNK2001: unresolved external symbol __imp__glHint@8
Lesson1.obj : error LNK2001: unresolved external symbol __imp__glDepthFunc@4
Lesson1.obj : error LNK2001: unresolved external symbol __imp__glEnable@4
Lesson1.obj : error LNK2001: unresolved external symbol __imp__glClearDepth@8
Lesson1.obj : error LNK2001: unresolved external symbol __imp__glClearColor@16
Lesson1.obj : error LNK2001: unresolved external symbol __imp__glShadeModel@4
Lesson1.obj : error LNK2001: unresolved external symbol __imp__glClear@4
Lesson1.obj : error LNK2001: unresolved external symbol __imp__wglDeleteContext@4
Lesson1.obj : error LNK2001: unresolved external symbol __imp__wglMakeCurrent@8
Lesson1.obj : error LNK2001: unresolved external symbol __imp__wglCreateContext@4
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/Lesson1.exe : fatal error LNK1120: 15 unresolved externals
Error executing link.exe.

Lesson1.exe - 16 error(s), 0 warning(s)
Yup, you need to link to opengl32.lib.

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

Okay...how do I do that? I''m not that experienced in messing with the options under VC++. If anyone has an OpenGL program that works on their PC, could you send it to me so I can see how if it will work on mine?
place these at the top of your source:

#pragma comment ( lib, "opengl32.lib" )
#pragma comment ( lib, "glu32.lib" )

quote:Original post by Anonymous Poster
place these at the top of your source:

#pragma comment ( lib, "opengl32.lib" )
#pragma comment ( lib, "glu32.lib" )




or in VC6, in project->settings->all configurations->link->object,library modules add opengl32.lib, glu32.lib, glut32.lib ro whatever you need.

and you need a main() functions, as an entry point for your program.

make sure your .lib are in c:\Program Files\Microsoft Visual Studio\VC98\lib

if you want, you can add extra paths for the libraries, in tools->options->directories. The order in which the directories are listed is important, like putting the DX9 SDK at the top of the list.

you can add extra include paths to just the project you are working on in project->settings->all configurations->C, C++->Additional Include Directories.

[edited by - oliii on April 4, 2003 5:39:42 AM]

Everything is better with Metal.

This topic is closed to new replies.

Advertisement