Advertisement

My Pong Program Errors

Started by August 26, 2001 08:21 PM
8 comments, last by Highwinded 23 years, 5 months ago
Ok, I''ve created a Pong Program with C++ and OpenGL. I know it works, I''ve played it. Its fun. However, sooner or later, it will not work anymore and its driving me insane. I get 23-25 errors about "imp_something" and I don''t understand why... also sometimes I get 25 warning about "=" and floats. NOW I get this damn error: Linking... .\Debug\Lesson10.obj : fatal error LNK1136: invalid or corrupt file Error executing link.exe. Lesson10.exe - 1 error(s), 0 warning(s) Someome please help me
To disable the precision truncation errors in Visual C++ (might work in other compilers) add the following to the top of your source code file.

#pragma warning(disable:4244)
#pragma warning(disable:4305)

If you get an error about an invalid or corrupt OBJ file try doing a clean build (Build -> Rebuild All in Visual C++) or delete the contents of the Debug/Release directory (this is where all your temporary files go).

I don't know what the imp_something errors are, if you get them again then give us the exact error you get. Makes it a lot easier to figure out the problem.

Hope this helps,

Jason A.

---
I write code.
DelphiGL (http://delphigl.cfxweb.net)

Edited by - Jallen on August 26, 2001 9:33:26 PM
---I write code.DelphiGL (http://delphigl.cfxweb.net)
Advertisement
The exact problems are the following:

--------------------Configuration: Lesson10 - Win32 Debug--------------------
Compiling...
Lesson10.cpp
Linking...
Lesson10.obj : error LNK2001: unresolved external symbol __imp__glEnd@0
Lesson10.obj : error LNK2001: unresolved external symbol __imp__glVertex3f@12
Lesson10.obj : error LNK2001: unresolved external symbol __imp__glColor3f@12
Lesson10.obj : error LNK2001: unresolved external symbol __imp__glBegin@4
Lesson10.obj : error LNK2001: unresolved external symbol __imp__glTranslatef@12
Lesson10.obj : error LNK2001: unresolved external symbol __imp__glLoadIdentity@0
Lesson10.obj : error LNK2001: unresolved external symbol __imp__glClear@4
Lesson10.obj : error LNK2001: unresolved external symbol _auxDIBImageLoadA@4
Lesson10.obj : error LNK2001: unresolved external symbol _gluPerspective@32
Lesson10.obj : error LNK2001: unresolved external symbol __imp__glMatrixMode@4
Lesson10.obj : error LNK2001: unresolved external symbol __imp__glViewport@16
Lesson10.obj : error LNK2001: unresolved external symbol __imp__glHint@8
Lesson10.obj : error LNK2001: unresolved external symbol __imp__glShadeModel@4
Lesson10.obj : error LNK2001: unresolved external symbol __imp__glDepthFunc@4
Lesson10.obj : error LNK2001: unresolved external symbol __imp__glClearDepth@8
Lesson10.obj : error LNK2001: unresolved external symbol __imp__glClearColor@16
Lesson10.obj : error LNK2001: unresolved external symbol __imp__glBlendFunc@8
Lesson10.obj : error LNK2001: unresolved external symbol __imp__glEnable@4
Lesson10.obj : error LNK2001: unresolved external symbol __imp__wglDeleteContext@4
Lesson10.obj : error LNK2001: unresolved external symbol __imp__wglMakeCurrent@8
Lesson10.obj : error LNK2001: unresolved external symbol __imp__wglCreateContext@4
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/Lesson10.exe : fatal error LNK1120: 22 unresolved externals
Error executing link.exe.

Lesson10.exe - 23 error(s), 0 warning(s)
Oh and also, if this helps, I used the first Lesson10 tutorial of the OpenGL Tutorial at this site. I''m 14, I don''t know that much about programming yet. =) Thanks again.
looks to me like you are missing some .lib file? or maybe haven't included some .cpp file to your project?

for example, maybe you have included
MyClasses.h
but havent added the proper .cpp file to the project
MyClasses.cpp

ah well, I don't know however

Edited by - Onaka on August 27, 2001 2:01:27 PM
Not really - just keep it calm guys.
You need to tell your compiler to link to the glu32.lib and opengl32.lib files. To do this in Visual C++ press Project -> Options -> Link and add the two libraries (separated by spaces) to the Object/library modules edit box.

Jason A.

---
I write code.
DelphiGL (http://delphigl.cfxweb.net)
---I write code.DelphiGL (http://delphigl.cfxweb.net)
Advertisement
Thank you Jason for the imp_ problem. But there are still two errors left..

Linking...
Lesson10.obj : error LNK2001: unresolved external symbol _auxDIBImageLoadA@4
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/Lesson10.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.

Lesson10.exe - 3 error(s), 0 warning(s)

>_< Evil Computer.
The auxDIBImageLoad function is part of the glaux library. Add glaux.lib to the same place you added glu32.lib and opengl32.lib.

The "unresolved external symbol _main" means that you are attemption to build a Console Application when what you want is a Win32 Application. A console application has an entry function (first function executed) and its always called main. A win32 application''s entry function is called WinMain.

To fix this all you need to do is add the following two lines:

#pragma comment (linker, "/ENTRY:WinMainCRTStartup")
#pragma comment (linker, "/SUBSYSTEM:WINDOWS")

to the top of your main source code file. This tells the compiler to look for a WinMain entry function instead of the main function.

Jason A.

---
I write code.
DelphiGL (http://delphigl.cfxweb.net)
---I write code.DelphiGL (http://delphigl.cfxweb.net)
Sorry if I sound like a annoying moron.. but this is the LAST question. Thanks to Jallen, all erros are fixxed and its error/warning free. However, I can''t seem to run it on my computer.. its brand new too. I keep getting a POP-UP error saying (Note, my pong program is still named Lesson10):

Debug Assertion Failed!

Program:C:\WINDOWS\DESKTOP\C++\DEBUG\LESSON10.EXE
File: fgets.c
Line: 60

Expression: str! = NULL


I checked my code for line 60 and it was in the middle of this:

GLfloat yrot;
GLfloat walkbias = 0;
GLfloat walkbiasangle = 0;
***GLfloat lookupdown = 0.0f;***
GLfloat z=0.0f;


the one with the *** is exact line 60... Help me Jason, Help me.
It says the error is on line 60 in fgets.c. If I remember correctly there is a function called fget that reads some data from a file. File errors are usually caused by missing or messed up data.

I just checked out lesson 10 and it looks like it loads a file containing a "world". Make sure you have this world file and that it is in the correct format.

Jason A.

---
I write code.
DelphiGL (http://delphigl.cfxweb.net)
---I write code.DelphiGL (http://delphigl.cfxweb.net)

This topic is closed to new replies.

Advertisement