#### Archived

This topic is now archived and is closed to further replies.

# Visual C++ .NET pissing me off.

This topic is 5016 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Im trying to build a Windows opengl program in visual c++, but Im getting these errors:
Heightmap fatal error LNK1120: 7 unresolved externals
Heightmap error LNK2019: unresolved external symbol _gluPerspective@32 referenced in function "void __cdecl ReshapeGL(int,int)" (?ReshapeGL@@YAXHH@Z)
Heightmap error LNK2019: unresolved external symbol __imp__glLoadIdentity@0 referenced in function "void __cdecl ReshapeGL(int,int)" (?ReshapeGL@@YAXHH@Z)
Heightmap error LNK2019: unresolved external symbol __imp__glMatrixMode@4 referenced in function "void __cdecl ReshapeGL(int,int)" (?ReshapeGL@@YAXHH@Z)
Heightmap error LNK2019: unresolved external symbol __imp__glViewport@16 referenced in function "void __cdecl ReshapeGL(int,int)" (?ReshapeGL@@YAXHH@Z)
Heightmap error LNK2019: unresolved external symbol __imp__wglDeleteContext@4 referenced in function _WinMain@16
Heightmap error LNK2019: unresolved external symbol __imp__wglMakeCurrent@8 referenced in function _WinMain@16
Heightmap error LNK2019: unresolved external symbol __imp__wglCreateContext@4 referenced in function _WinMain@16

Im guessing that I have to link external stuff, like the opengl library, and some windows libs, like I did with VC++ 6. But with .NET, I cant find where to do it! Ive looked everywhere and its very frustrating.

##### Share on other sites
Tools->Options->Projects->VC++ Directories->Select "Libraries" from the "Show Directories for:" dropdown.

Cheers,
Paul Cunningham

Pumpkin Games

[edited by - paulcunningham on March 23, 2004 5:29:58 PM]

##### Share on other sites
Thanks PCh,

It seems that it was already set up to include the right directory. So any ideas about why I am getting these errors?

##### Share on other sites
Project properties->Linker->Input->Additional Dependencies. You need to add the name of each library explicitly. If it is in one of the directories specified in the dialog Paul mentioned, you can just give the name. Otherwise, you will have to give an absolute or relative(to the project directory) path.

--
AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.
[Project site] [Blog] [RSS] [Browse the source] [IRC channel]

##### Share on other sites
Thanks again,

but I''m afraid that "Project properties" does not exist! Where is it supposed to be?

Sorry for the dumb question, but I really have been at this for a while now

##### Share on other sites
It should be on the menu under Project. Then choose properties (at very bottom). The menus change based on what you are currently looking at so maybe that''s why you can''t see it. You need to have the project opened. If you are looking at one of your source files then it should be in the menu. You can also right click on the project name in the right-hand side (where your file are listed under source, headers, etc.) and choose properties there.

- WarbleWare

##### Share on other sites
Ok slowly getting somewhere (i hope) but ive run into another problem. I got into project->properties (I had the solution explorer closed, which apparently disabled properties from the project menu), but now there is nothing anywhere that mentions linker. Maybe a picture is in order:

##### Share on other sites
Hmm, I''m not sure (don''t have VS in front of me now), but I''d guess that pic shows the "Solution Properties" not the "Project Properties". A solution can have multiple projects in it, each with its own properties. Have you added files to your project yet? I''ve always added files before changing project properties. So maybe that matters. In the Solution Explorer, you should be able to right-click on the project name (not solution name) to get project props.

- WarbleWare

##### Share on other sites
In the solution explorer, rightclick the project name,
(not the solution at the top), then properties->Linker->Input.
At the top of that page you have "Additional Dependencies",
add the libs your project need on that line.

, Dang, reana1 beat me to it.

[edited by - Allmight on March 23, 2004 6:32:10 PM]

##### Share on other sites
#pragma comment(lib, "libname.lib")

will do just fine...

##### Share on other sites
Ok that seems to have helped (program still wont run, but I think thats a different story). Thanks for your patience, everyone. I guess what really confused me is that Ive never done this linker set up stuff before, but I have a couple other projects that all use opengl with no problem.
wierd.

• ### Forum Statistics

• Total Topics
628726
• Total Posts
2984411

• 25
• 11
• 10
• 16
• 14