error opening opengl32.dll

hi there.
i have VS6 and i keep getting this message


--------------------Configuration: win_main - Win32 Debug--------------------
Linking…
LINK : fatal error LNK1104: cannot open file “opengl32.dll”
Error executing link.exe.

win_main.exe - 1 error(s), 0 warning(s)

can any1 out there help me please

You link with opengl32.lib and glu32.lib, not the dll.

when i link the .lib file i get this error


--------------------Configuration: Main - Win32 Debug--------------------
Linking…
Main.obj : error LNK2001: unresolved external symbol “void __cdecl InitializeOpenGL(int,int)” (?InitializeOpenGL@@YAXHH@Z)
Main.obj : error LNK2001: unresolved external symbol “void __cdecl DeInit(void)” (?DeInit@@YAXXZ)
Main.obj : error LNK2001: unresolved external symbol “void __cdecl SizeOpenGLScreen(int,int)” (?SizeOpenGLScreen@@YAXHH@Z)
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/Main.exe : fatal error LNK1120: 4 unresolved externals
Error executing link.exe.

Main.exe - 5 error(s), 0 warning(s)

Hi !

The first 3 are missing functions from some other library that you need to link your application, you have also tried to link your application as a console application (needs _main) but you don’t have one, I guess you have a WinMain instead, that’s fine but you need to use the correct options to the linker to make that work.

Mikael

right this what im doing…

i got this source code from www.gametutorials.com
i cant afford college so im on my own here

right this is what i do first.
i get the raw code form there site. http://www.gametutorials.com/download/OpenGL/FirstProgram_OGL.zip

i then compile it and here is the first error i get

--------------------Configuration: Main - Win32 Debug--------------------
Linking…
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/Main.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

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

then i include opengl32.dll and glu32.dll in the project–>>setting>>>linker files tab

then i compile it and i get this

--------------------Configuration: Main - Win32 Debug--------------------
Linking…
LINK : fatal error LNK1104: cannot open file “opengl32.dll”
Error executing link.exe.

Main.exe - 1 error(s), 0 warning(s)

THEN! i take out the opengl32.dll and glu32.dll in the linker tab and input opengl32.lib and glu32.lib and get this error

--------------------Configuration: Main - Win32 Debug--------------------
Linking…
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/Main.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

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

and then i close everything coz im pissed off

help! please

As was said, you have made a win32 application, and the compiler expects a win32 console application. Either create a win32 project, or replace your WinMain function with a main function

Hi again !

I don’t have it in front of me, but there is an option to set console/windows app, I think the actual switch is /SUBSYSTEM:WINDOWS (to the linker)

Mikael

now i get this ?

--------------------Configuration: iip - Win32 Debug--------------------
Compiling…
iip.cpp
c:\documents and settings\decon\desktop\lol\iip\iip.cpp(561) : fatal error C1010: unexpected end of file while looking for precompiled header directive
Error executing cl.exe.

iip.obj - 1 error(s), 0 warning(s)

:S i dont know now

Sorry if it comes across a bit harsh, but I strongly suggest that you learn what a compiler, a preprocessor and a linker does prior to learn OpenGL.

Starting with some basic or intermediate C++ couldnt hurt either.

If you already stumple over simple linker/preprocessor problems you want to improve your programming skills or you will run into major trouble sooner or later.

Regards.

The fun folks at microsoft always turn on precompiled headers for you so you have to either turn of “Pre compiled header (PCH)” in the compilers options or add the line:

#include “stdafx.h”

(I think they always call the file stdafx.h)

At the top of iip.cpp (must be first non comment line)

ok this is something i just congured upp in about 20 minutes its not finished but tell me
am i using preproccesors here ?

//defines
#define END() <<endl<<endl;
#define LONG_LINE() cout<<"********************************************************************************"<<endl<<endl;
#define BLANK_LINE() cout<<" “<<endl<<endl;
#define GREEN() DrawColorString(”",0,0,FOREGROUND_GREEN);
//includes
#include <iostream>
#include <string>
#include <fstream>
#include <windows.h>
#include <time.h>

using namespace std;

//initualizing colour*

void DrawColorString(string sztext, int X, int Y, WORD color)
{
	HANDLE OutputH;
	COORD position = {X, Y};
	OutputH = GetStdHandle(STD_OUTPUT_HANDLE);
	SetConsoleTextAttribute(OutputH, color);
	SetConsoleCursorPosition(OutputH, position);
	cout&lt;&lt;sztext;
}

int main(void)
{

//strings start***********************************************************************************

string szname;
string szage;
string szgender;
string szlocation;
string szmaritalstatus;
string szcurrentemployment;
string szcurrentsalary;
string szexpectedsalary;
string szanswer;
string szusername;
string szpassword;
string szmenu;

//strings end*************************************************************************************

GREEN()


void DrawMenu();

{


LONG_LINE()

cout&lt;&lt;"*                         Welcome to the main menu                             *"&lt;&lt;endl;

LONG_LINE()
cout&lt;&lt;"*                         1.)Register                                          *"&lt;&lt;endl;
cout&lt;&lt;"*                         2.)Log-in                                            *"&lt;&lt;endl;
cout&lt;&lt;"*                         3.)Change Username ans password                      *"&lt;&lt;endl;
cout&lt;&lt;"*                         4.)Exit                                              *"&lt;&lt;endl;

cout&lt;&lt;"Please Select a choice"END()

LONG_LINE()

cin&gt;&gt;szanswer;


}

if( ( szanswer == "1" ) | | ( szanswer == "1") )
{
	cout&lt;&lt;"Thank you!"END()
	cout&lt;&lt;"You will now be directed to the registration page"END()
	cout&lt;&lt;"Please Wait"END()
	Sleep(1500);
	cout&lt;&lt;"Now Loading"END()
	Sleep(1300);


	LONG_LINE()
	cout&lt;&lt;"*                      Please fill in the required questions              *"END()

	ofstream fout;
	fout.open("user.txt");

	//asking user for his.her name*
	cout&lt;&lt;"What is your name"END()
	cin&gt;&gt;szname;
	fout&lt;&lt;"User: "&lt;&lt;szname&lt;&lt;endl;

	//asking user for his/her age*
	cout&lt;&lt;"What is your age"END()
	cin&gt;&gt;szage;
	fout&lt;&lt;"Age: "&lt;&lt;szage&lt;&lt;endl;

	//asking user for his/her Location
	cout&lt;&lt;"What is your current location &lt;ie.UK,USA.ect&gt;"END()
	cin&gt;&gt;szlocation;
	fout&lt;&lt;"Location: "&lt;&lt;szlocation&lt;&lt;endl;

	//aking user to chose his/her username
	cout&lt;&lt;"Please type in a user name that you will use to log on"END()
	cin&gt;&gt;szusername;
	fout&lt;&lt;"Username: "&lt;&lt;szusername&lt;&lt;endl;

	//asking user to enter a password in with thay will use to log on
	cout&lt;&lt;"Please enter a password"END()
	cin&gt;&gt;szpassword;
	fout&lt;&lt;"Password: "&lt;&lt;szpassword&lt;&lt;endl;

	//returning to the main menu
	cout&lt;&lt;"Thank you,you will now be transported back to the main menu"END()

	fout.close();

}

if( ( szanswer == "2" ) | | ( szanswer == "2") )
{
	cout&lt;&lt;"User name"END()
	cin&gt;&gt;szusername;



	

}

if( ( szanswer == "3") | | ( szanswer == "3" ) )
{
	cout&lt;&lt;"3"END()
}

if( ( szanswer == "4" ) | | ( szanswer == "4" ) )
{
	
	return 0;
}

if( ( szanswer &gt; "4" ) | | (  szanswer &gt; "4") )
{
	cout&lt;&lt;"!INVALID!,PLEASE CHOSE A ITEM FROM THE MENU!"END()
	return 0;
}

return 0;

}

thanks mr 1234 for the encouragment ???
2 days ive been doing this for gimme a break

He’s right, though. You should try to get some more basic C/C++ programming experience. The errors are telling you what’s wrong, but you just aren’t listening, or more likely, don’t know how to interpret what it’s telling you.

When a linker error says that you are missing function X, it means you are missing function X, either because it is part of a library you didn’t include or because you didn’t code it. So if it tells you you don’t that the main or WinMain function is missing, you better code up a main or WinMain function depending on what it tells you.

Originally posted by ianbrown:
[b]ok this is something i just congured upp in about 20 minutes its not finished but tell me
am i using preproccesors here ?

//defines
#define END() <<endl<<endl;
#define LONG_LINE() cout<<“********************************************************************************”<<endl<<endl;
#define BLANK_LINE() cout<<" “<<endl<<endl;
#define GREEN() DrawColorString(”",0,0,FOREGROUND_GREEN);
[/b]

Yes you do, the #define’s get expanded by the preprocessor. So very time you say “END()” in your code the preprocessor will replace that with “<<endl<<endl;”.

Hope that helps.

Originally posted by ianbrown:
thanks mr 1234 for the encouragment ???
2 days ive been doing this for gimme a break

You misunderstood me. All I am saying is that this is the wrong forum for c++ beginners questions.
The name of the forum is “OpenGL coding: beginners” that means beginners to OpenGL development, not for people who begin to code.

Hope that clears it up.

hi 1234
i understand pre-proccesors.
yeah maybe i was trying to run b4 i could walk,i ordered a book from amazon.co.uk for beginner programmers c++ and VB,i will study that book back to front.thanks for the help anyways,i just wanted to try out opengl for the hell of it but ill study codeing solid first…thanks :stuck_out_tongue:

Understanding of pre-processor directives isn’t the same thing as understanding the process of compiling and linking. And it obviously wasn’t enough for you to understand what the linker was telling you.

I don’t mean to be mean. There are just a lot of concepts you should understand before trying to get too deep into OpenGL. And it’s good that you are taking the first steps to understanding programming. I can also understand wanting to jump right into something fun like OpenGL, but by trying to do that, you are going to cause yourself a lot more headaches than if you took the time to learn the basics first.

Good luck!

Originally posted by ianbrown:
hi 1234
yeah maybe i was trying to run b4 i could walk,i ordered a book from amazon.co.uk for beginner programmers c++ and VB,i will study that book back to front.thanks for the help anyways,i just wanted to try out opengl for the hell of it but ill study codeing solid first…thanks :stuck_out_tongue:

Thats sounds great. I am sorry if I came across rude I did not mean to. After all, I once was a C/C++ beginner too.

When you got the hang of C++ and the Visual Studio you are more then welcome on this board so we can have some fun with OpenGL

Regards,

dude im more than welcome any way ?

Dude, what are you? 12? People give you constructive criticism and you’re like, “I can do what I want if I wanna…” Grow up.

Next you’ll be asking about pointers and object-oriented paradigms…