error LNK2019

I am using visual C++ 2010 Express. I am taking a example from aaindex.c and when I build I get this error:

1>—— Build started: Project: test7, Configuration: Debug Win32 ——
1>aaindex.obj : error LNK2019: unresolved external symbol __imp__glClearIndex@4 referenced in function _init
1>aaindex.obj : error LNK2019: unresolved external symbol __imp__glLineWidth@4 referenced in function _init
1>aaindex.obj : error LNK2019: unresolved external symbol __imp__glHint@8 referenced in function _init
1>aaindex.obj : error LNK2019: unresolved external symbol __imp__glEnable@4 referenced in function _init
1>aaindex.obj : error LNK2019: unresolved external symbol __imp__glFlush@0 referenced in function _display
1>aaindex.obj : error LNK2019: unresolved external symbol __imp__glPopMatrix@0 referenced in function _display
1>aaindex.obj : error LNK2019: unresolved external symbol __imp__glEnd@0 referenced in function _display
1>aaindex.obj : error LNK2019: unresolved external symbol __imp__glVertex2f@8 referenced in function _display
1>aaindex.obj : error LNK2019: unresolved external symbol __imp__glBegin@4 referenced in function _display
1>aaindex.obj : error LNK2019: unresolved external symbol __imp__glRotatef@16 referenced in function _display
1>aaindex.obj : error LNK2019: unresolved external symbol __imp__glPushMatrix@0 referenced in function _display
1>aaindex.obj : error LNK2019: unresolved external symbol __imp__glIndexi@4 referenced in function _display
1>aaindex.obj : error LNK2019: unresolved external symbol __imp__glClear@4 referenced in function _display
1>aaindex.obj : error LNK2019: unresolved external symbol _gluOrtho2D@32 referenced in function _reshape
1>aaindex.obj : error LNK2019: unresolved external symbol __imp__glLoadIdentity@0 referenced in function _reshape
1>aaindex.obj : error LNK2019: unresolved external symbol __imp__glMatrixMode@4 referenced in function _reshape
1>aaindex.obj : error LNK2019: unresolved external symbol __imp__glViewport@16 referenced in function _reshape
1>C:\Users\comet\documents\visual studio 2010\Projects\test7\Debug\test7.exe : fatal error LNK1120: 17 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Answer to this question:

You need to add opengl32.lib to your linker input additional dependencies.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s