Sign in to follow this  

Error!!!

This topic is 3810 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys, i' m new here and i' m Italian (so i hope you understand my english). I have one problem: i tried to compile the code of the 1st tutorial, but after compiling appears a window with this massage(i use Dev-C++): C:\DOCUME~1\pio\IMPOST~1\Temp\cceGbaaa.o(.text+0x38):lesson1.cpp: undefined reference to `glViewport@16' C:\DOCUME~1\pio\IMPOST~1\Temp\cceGbaaa.o(.text+0x45):lesson1.cpp: undefined reference to `glMatrixMode@4' C:\DOCUME~1\pio\IMPOST~1\Temp\cceGbaaa.o(.text+0x4d):lesson1.cpp: undefined reference to `glLoadIdentity@0' C:\DOCUME~1\pio\IMPOST~1\Temp\cceGbaaa.o(.text+0x84):lesson1.cpp: undefined reference to `gluPerspective@32' C:\DOCUME~1\pio\IMPOST~1\Temp\cceGbaaa.o(.text+0x91):lesson1.cpp: undefined reference to `glMatrixMode@4' C:\DOCUME~1\pio\IMPOST~1\Temp\cceGbaaa.o(.text+0x99):lesson1.cpp: undefined reference to `glLoadIdentity@0' C:\DOCUME~1\pio\IMPOST~1\Temp\cceGbaaa.o(.text+0xb7):lesson1.cpp: undefined reference to `glShadeModel@4' C:\DOCUME~1\pio\IMPOST~1\Temp\cceGbaaa.o(.text+0xd1):lesson1.cpp: undefined reference to `glClearColor@16' C:\DOCUME~1\pio\IMPOST~1\Temp\cceGbaaa.o(.text+0xe0):lesson1.cpp: undefined reference to `glClearDepth@8' C:\DOCUME~1\pio\IMPOST~1\Temp\cceGbaaa.o(.text+0xf0):lesson1.cpp: undefined reference to `glEnable@4' C:\DOCUME~1\pio\IMPOST~1\Temp\cceGbaaa.o(.text+0x100):lesson1.cpp: undefined reference to `glDepthFunc@4' C:\DOCUME~1\pio\IMPOST~1\Temp\cceGbaaa.o(.text+0x115):lesson1.cpp: undefined reference to `glHint@8' C:\DOCUME~1\pio\IMPOST~1\Temp\cceGbaaa.o(.text+0x13b):lesson1.cpp: undefined reference to `glClear@4' C:\DOCUME~1\pio\IMPOST~1\Temp\cceGbaaa.o(.text+0x143):lesson1.cpp: undefined reference to `glLoadIdentity@0' C:\DOCUME~1\pio\IMPOST~1\Temp\cceGbaaa.o(.text+0x258):lesson1.cpp: undefined reference to `wglMakeCurrent@8' C:\DOCUME~1\pio\IMPOST~1\Temp\cceGbaaa.o(.text+0x282):lesson1.cpp: undefined reference to `wglDeleteContext@4' C:\DOCUME~1\pio\IMPOST~1\Temp\cceGbaaa.o(.text+0x854):lesson1.cpp: undefined reference to `ChoosePixelFormat@8' C:\DOCUME~1\pio\IMPOST~1\Temp\cceGbaaa.o(.text+0x898):lesson1.cpp: undefined reference to `SetPixelFormat@12' C:\DOCUME~1\pio\IMPOST~1\Temp\cceGbaaa.o(.text+0x8ce):lesson1.cpp: undefined reference to `wglCreateContext@4' C:\DOCUME~1\pio\IMPOST~1\Temp\cceGbaaa.o(.text+0x914):lesson1.cpp: undefined reference to `wglMakeCurrent@8' C:\DOCUME~1\pio\IMPOST~1\Temp\cceGbaaa.o(.text+0xc2f):lesson1.cpp: undefined reference to `SwapBuffers@4' I don't know where is the error, the code is the original code of the tutorial. I hope you can help me, thanks!

Share this post


Link to post
Share on other sites
That is a link-time error, not a compile-time error. You need to add the opengl32 and glu32 to the list of libraries to link to. Download the Dev-C++ version of the tutorial and have a look at how the project is set up.
(I assume you mean NeHe tutorial 1. If not, download it anyway and it will show you what settings you need.)

Share this post


Link to post
Share on other sites
Sorry for my stupidity, but how can I add those library in Dev-C++, i didn't find where to add theme. Do you know? Thanks!

Share this post


Link to post
Share on other sites
On the Project menu, select Project Options. There should be a place there to add additional linker command-line options. Enter -lopengl32 and -lglu32.

Share this post


Link to post
Share on other sites
OK, i've done it. I have added these library: lopengl32, lglu32 and glaux32, but there is still some link error(only a few):

c:\opengl\lesson01\lesson01\lesson.o(.text+0x854):lesson.cpp: undefined reference to `ChoosePixelFormat@8'
c:\opengl\lesson01\lesson01\lesson.o(.text+0x898):lesson.cpp: undefined reference to `SetPixelFormat@12'
c:\opengl\lesson01\lesson01\lesson.o(.text+0xc2f):lesson.cpp: undefined reference to `SwapBuffers@4'


What library do I miss?
Thanks!

Share this post


Link to post
Share on other sites
kernel32, user32 and or gdi32. You can search for the undefined references on msdn and it will tell you exactly which library you need

Share this post


Link to post
Share on other sites
Now, i tried to use Microsoft Visual C++, but it gives me this error after building (it compiles with no error) :

LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Lesson1.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

Lesson1.exe - 2 error(s), 0 warning(s)

I don't know what it means!

Share this post


Link to post
Share on other sites
It means that you created a console application rather than a Win32 application. Console applications expect a main function. Win32 applications expect a WinMain.

Make sure you select the correct project type when you create the project.

Share this post


Link to post
Share on other sites
File->New->Project... choose WIN32 PROJECT (don't choose console) then paste your code in add your libraries to the project settings. Compile...
You should be good after that.
-durfy

Share this post


Link to post
Share on other sites

This topic is 3810 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this