473,396 Members | 1,940 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

OpenGL error in Visual Studio 2005

114 100+
Hi guys.
I was using this code in VC++ 2005 and I got 3 errors.
Errors:
Error 1 error LNK2019: unresolved external symbol __imp____glutInitWithExit@12 referenced in function _glutInit_ATEXIT_HACK@8 main.obj

Error 2 error LNK2019: unresolved external symbol __imp____glutCreateWindowWithExit@8 referenced in function _glutCreateWindow_ATEXIT_HACK@4 main.obj

Error 3 fatal error LNK1120: 2 unresolved externals D:\C++\OpenGL\My App\Debug\My App.exe

Code:
Expand|Select|Wrap|Line Numbers
  1.  
  2. #include <GL/glut.h>
  3.  
  4. void display(void)
  5. {
  6.     //clear all pixels
  7.     glClear(GL_COLOR_BUFFER_BIT);
  8.  
  9.     /*draw a white polygon (rectangle) with corners at (0.25, 0.25, 0.25) and (0.75, 0.75, 0.75)*/
  10.  
  11.     glColor3f(1.0, 1.0, 1.0);
  12.     glBegin(GL_POLYGON);
  13.         glVertex3f(0.25, 0.25, 0.25);
  14.         glVertex3f(0.75, 0.25, 0.0);
  15.         glVertex3f(0.75, 0.75, 0.0);
  16.         glVertex3f(0.25, 0.75, 0.0);
  17.     glEnd();
  18.     glFlush();
  19. }
  20.  
  21. void init(void)
  22. {
  23.     //select clearing background color
  24.     glClearColor(0.0, 0.0, 0.0, 0.0);
  25.  
  26.     //init viewing values
  27.     glMatrixMode(GL_PROJECTION);
  28.     glLoadIdentity();
  29.     glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
  30. }
  31.  
  32.  
  33.  
  34. int main(int argc, char** argv)
  35. {
  36.  
  37.     glutInit(&argc, argv);
  38.     glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
  39.     glutInitWindowSize(250, 250);
  40.     glutInitWindowPosition(100, 100);
  41.     glutCreateWindow("KILL ALL HUMANS!!!");
  42.     init();
  43.     glutDisplayFunc(display);
  44.     glutMainLoop();
  45.     return 0; /* ISO C requires main to return int */
  46. }
  47.  
Oct 24 '07 #1
5 5784
You must instruct the linker to link the glu32 and opengl32 libraries.
Oct 24 '07 #2
Firecore
114 100+
You must instruct the linker to link the glu32 and opengl32 libraries.
did that. i also linked it to the glut lib file
Oct 24 '07 #3
weaknessforcats
9,208 Expert Mod 8TB
did that. i also linked it to the glut lib file
Did you also specify the paths to the libraries??
Oct 25 '07 #4
Firecore
114 100+
Did you also specify the paths to the libraries??
no. in properties, i just added the names.
Oct 25 '07 #5
weaknessforcats
9,208 Expert Mod 8TB
You need to add the paths or the linker can't find the libraries.

Go to Tools->Options->Projects and Solution->VC++ Directories->Show directories-.Select Library Files

And add the path (or paths) here.
Oct 25 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Scott Chang | last post by:
Hi all, I tried to use Managed C++ coding of VC++.NET (2002)and OpenGL version 1.2 to draw a hexagon shape of benzene. My OpenGLdrawBenzene.cpp is the following: // This is the main project file...
1
by: Scott Chang | last post by:
Hi All I tried to use the attached OpenGL code to draw a Star-shaped figure on my Microsoft Visual C++ .NET 2002-Windows XP Pro PC. When I did 'Build' in Debug Mode, I got an error C2065:...
1
by: iredshift | last post by:
Hello, I am trying to use visual c++ express to write opengl programs for a class because I don't have the full visual studio program. However, when I downloaded and installed visual c++ express...
4
by: mcwooq | last post by:
Hi, I just installed the VS.Studio 2005 Team Edition for Developper and encountered severe problems with debugging ASP.NET 2.0 projects. Even newly empty created ASP 2.0 projects can't debug...
1
yabansu
by: yabansu | last post by:
Hi all, I implemented a basic client application. It communicates with server and works properly. Building processes succeed just by giving the following warning: LINK : D:\DOC\Visual Studio...
2
by: thersitz | last post by:
Hi, I have VStudio2005, SQLServer 2005 dev edition loaded on a windowsXP Pro machine. I installed it ok. I just attempted to load the Personal Web Site Starter Kit (I downloaded off...
1
by: misu101 | last post by:
Hi, I have a VS 6 project and I am trying to compile it using VS 2005. My program has the atlbase.h include which seems to trigger the errors. It used to compile OK using VS 6. The include...
2
by: yalbizu | last post by:
#include <iostream> #include <string> #include <fstream> #include <iomanip> using namespace std; const int NO_OF_STUDENTS=20; struct studentType { string studentFName; string studentLName;
7
by: Norman Diamond | last post by:
A project depends on VC runtime from Visual Studio 2005 SP1, and DotNet Framework 2. Options are set in the setup project properties, so if these two dependencies are not already installed then...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.