Jump to content

  • Log In with Google      Sign In   
  • Create Account

Help, Please!!! It won't work!


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 Blender Boy   Members   -  Reputation: 122

Like
Likes
Like

Posted 05 August 2001 - 04:31 AM

I have tried everything! I even downloaded NeHe''s Lesson 1 for Open GL, but when I compile even HIS source code I get two error linking messages. One says: error LNK2001: unresolved external symbol _main And the other says: fatal error LNK1120: 1 unresolved externals I have linked the Open GL libraries to my program (I double-checked, yes, I linked all three) Please help!!!

Sponsor:

#2 evaclear   Members   -  Reputation: 162

Like
Likes
Like

Posted 05 August 2001 - 04:56 AM

Looks like you made the wrong project under VC. If you have a
int main(void) function in your program you need to create a console application. Otherwise you need to create a win32 application.

#3 mittens   Moderators   -  Reputation: 1315

Like
Likes
Like

Posted 05 August 2001 - 05:20 AM

Also, you can just use NeHe''s included project and workspace files, so you can just compile it right off the bat.

------------------------------
Trent (ShiningKnight)
E-mail me
Shining Darkness- A division of Chromesphere Studios

#4 Blender Boy   Members   -  Reputation: 122

Like
Likes
Like

Posted 05 August 2001 - 11:05 AM

Thanx, but I''ve tried both already and neither work!!!

#5 zedzeek   Members   -  Reputation: 528

Like
Likes
Like

Posted 06 August 2001 - 10:36 AM

it sounds like u using vc. try downloading a glut version of the nehe program + compile that. dont link with any librarys this should be done hopefully.

#6 TerranFury   Members   -  Reputation: 142

Like
Likes
Like

Posted 10 August 2001 - 09:55 AM

Go to Project->Settings. Under the "Link" tab there is a text box labeled "Project Options." Somewhere in it, you'll find the text "/subsystem:console" although you really want it to read "/subsystem:windows" because you're making a Windows program. Change that and it will work.

Edited by - TerranFury on August 10, 2001 4:57:56 PM

#7 binary1230   Members   -  Reputation: 122

Like
Likes
Like

Posted 10 August 2001 - 02:55 PM

I''m a bit bored, so I''ll sum up everything thats been said so far in easy terms.

------------------------------------------------
Project Type Differences
------------------------------------------------
There''s two [main] kinds of projects you can make in VC++:

Win32 Console Application
It''s like the old-style C++ (you know, using printf() and cout)]
It runs in DOS and you cant use any of the stuff from Windows [like graphics/etc].

Win32 Application
This is the one you want. This one runs under windows, not DOS. You can do all the stuff with the Windows API/OpenGL here.

------------------------------------------------
Startup Function Differences
------------------------------------------------
Win32 Console Application
The startup function used in the DOS app is this:
int main();

Win32 Application
The startup function used here is this:
int WINAPI WinMain(....);

------------------------------------------------
Libraries
------------------------------------------------

OpenGL''s libraries are not included in the VC++ default project settings. You must put them there yourself.

There are two ways to do this under VC++.

One is in the Project menu, under Settings. In one of the tabs there somewhere [I can''t remember off the top of my head, I think its under ''Link''] is a textbox that has a bunch of libraries listed under it. Add to the end of that list the following:

OpenGL32.lib GLu32.lib GLaux.lib

The other method I like better myself, because you dont need to add those libraries to the Link Settings every time you make a new OpenGL project. With this method, you add the libraries directly in your source code. However, there are portability issues, but at this stage in development, no one cares.

Just go to the very first line in your program [above the includes] and add the following lines:

#pragma comment(lib, "OpenGL32.lib")
#pragma comment(lib, "GLu32.lib")
#pragma comment(lib, "GLaux32.lib")

[As a small note, make sure these libraries exist on you machine in C:\windows\system\, or else either method wont work]

------------------------------------------------
Summary
------------------------------------------------

If you''re getting a message about UNRESOLVED SYMBOL MAIN(), then you have created a Win32 Console Application. You need to create a Win32 Application, not Console.

Repeat: Create a
WIN32 APPLICATION
not
WIN32 CONSOLE APPLICATION

With the libraries, including just the header files for OpenGL is not enough, you have to manually include the libraries for OpenGL

------------------------------------------------

Anyway, as you can see I was bored, but I hope this helps you out.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS