Sign in to follow this  
laserdude45

These errors....

Recommended Posts

[Linker error] undefined reference to `ChoosePixelFormat@8' [Linker error] undefined reference to `SetPixelFormat@12' [Linker error] undefined reference to `SwapBuffers@4' How do I fix those errors? They come up whenever I try to compile a program. Im using dev-cpp.

Share this post


Link to post
Share on other sites
Those errors mean you are not linking against the right library.

For example, undefined reference to `ChoosePixelFormat@8' means your linker is looking for a function called 'ChoosePixelFormat' that takes 8 bytes of parameters. It searches through all the object files and libraries looking for the function, and the linker can't find it.

You need to tell the linker where to search for the function. It is probably in a library called opengl32.lib.


In your linker options, add the library file name to the list.

I don't use dev-cpp, so I don't know the details of doing it, nor the dev-c++ file locations. You might need to adjust your .lib search paths or otherwise make sure your configuration is correct.

Share this post


Link to post
Share on other sites
Quote:
by http://msdn.microsoft.com/library/default.asp?url=/library/en-us/opengl/ntopnglr_2qb8.asp

ChoosePixelFormat

...

Requirements
Windows NT/2000: Requires Windows NT 3.5 or later.
Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
Header: Declared in wingdi.h.
Import Library: Use gdi32.lib.


Try linking against gdi32.lib.

Share this post


Link to post
Share on other sites

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