View Full Version : WHY WOULD'T A COMPILER EXECUTE- HELP!!!!!!!!!!!!!!!!
Compiler (Bloodshed) won;t execute the program even though I have no errors. The compiler output is
c:\scott's stuff\open gl\programs\untitled1.o(.text+0x2a3):untitled1.c: undefined reference to `wglCreateContext@4'
c:\scott's stuff\open gl\programs\untitled1.o(.text+0x2c1):untitled1.c: undefined reference to `wglMakeCurrent@8'
c:\scott's stuff\open gl\programs\untitled1.o(.text+0x2da):untitled1.c: undefined reference to `wglMakeCurrent@8'
c:\scott's stuff\open gl\programs\untitled1.o(.text+0x2e9):untitled1.c: undefined reference to `wglDeleteContext@4'
Those look a lot like errors to me....
Anyway, what the compiler is trying to tell you is that it can't find those functions anywhere (wglCreateContext, wglMakeCurrent, wglDeleteContext). Have you included the Windows and OpenGL libraries in addition to adding the header files to your project?
If you have the header files, but not the actual code for those functions in your project, the c code will compile perfectly well, but the linker will be unable to find the functions in any of your project's code, thus causing an error.
I copied the code strait out of the opengl superbible, the program should just create a black window it still won't work.
I copied the code strait out of the opengl superbible, the program should just create a black window it still won't work. I looked at what you(j) suggested and as far as I can see it should work because the program in the book doesn't have the functions that the linker can't find
04-22-2001, 03:03 PM
You are missing the point j was trying to make... the code is fine, but you do not have the libraries for your compiler.
Copying the code straight out of a book isn't going to guarantee that you have the correct libraries for your compiler.
I'm not fimiliar with Bloodshed so I wouldn't have the first clue where to find the libraries for it. If you don't understand the difference between libraries, and headers, go back to learning C/C++ before you tackle OpenGL. It'd be a lot more productive than saying j's suggestion is wrong because YOU think it should work.
Just an additional note, it may be just that you are not including the libraries in the project. Compilers don't usually just magically include the libraries you need for you. And again, that is not something you do in code, but actually tell your compiler to do. (In the form of command-line parameters, or project settings.)
[This message has been edited by Deiussum (edited 04-22-2001).]
04-22-2001, 05:29 PM
Right, you should create a windows GUI app so that the standard Windows libraries is linked to. The wgl functions is GDI functions and will be in any Windows GUI app. The alternative is to write a list with libraries or use the -mwindows option.
04-22-2001, 10:43 PM
Click on the "projects" menu then "Project Options" then type this "-lopengl32 -lglu32 -lglut32" into the text box labeled "Further Object files or Linker options"
This tells the compiler to link the code in these files to your programme. NOTE: Dev-C++ uses lib's with a filename like "libopengl32.a" so you may need to rename some of the files to make it work, i.e. "glut32.lib" to "libglut32.a" otherwise use the button "Load Object Files". If you don't need one of the lib's above just don't put it in.
THANX FOR THE HELP IT WORKS!
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.