For Programmers: Free Programming Magazines  


Home > Archive > VC Language > November 2005 > Where to start on an error?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Where to start on an error?
jimmy.duguay@gmail.com

2005-11-25, 7:58 am

Hi,

I posted this question in comp.lang.c++ and someone said I might have
better luck in this group.

I am trying to build a project in VC++ Express but am getting the
following errors:

arena.obj : error LNK2019: unresolved external symbol
___glutInitWithExit@12 referenced in function _glutInit_ATEXIT_HACK@8
arena.obj : error LNK2019: unresolved external symbol
___glutCreateWindowWithExit@8 referenced in function
_glutCreateWindow_ATEXIT_HACK@4
.../wbin/Arena.exe : fatal error LNK1120: 2 unresolved externals


In general, how should one start on a seemingly obscure errors like
this? (obscure to me at least)

Note I am fairly new to c++ and VC


-Jimmy

Ulrich Eckhardt

2005-11-25, 7:58 am

jimmy.duguay@gmail.com wrote:
> arena.obj : error LNK2019: unresolved external symbol
> ___glutInitWithExit@12 referenced in function _glutInit_ATEXIT_HACK@8
> arena.obj : error LNK2019: unresolved external symbol
> ___glutCreateWindowWithExit@8 referenced in function
> _glutCreateWindow_ATEXIT_HACK@4
> ../wbin/Arena.exe : fatal error LNK1120: 2 unresolved externals
>
>
> In general, how should one start on a seemingly obscure errors like
> this? (obscure to me at least)


It means that when linking the different objectfiles to an executable, the
function glutInit_ATEXIT_HACK was using __glutInitWithExit which could not
be found. The usual two causes to this problem are:
1. A library is missing, enter it in the projectsettings or use "#pragma
comment(lib, ...)" to add it.
2. The order of the libraries on the linker commandline is wrong. At least
for Unix linkers, the libs must come after the libs or objectfiles that use
them.

Uli

Norm Dresner

2005-11-25, 7:02 pm

"Ulrich Eckhardt" <eckhardt@satorlaser.com> wrote in message
news:0gej53-o8b.ln1@satorlaser.homedns.org...
> jimmy.duguay@gmail.com wrote:
>
> It means that when linking the different objectfiles to an executable, the
> function glutInit_ATEXIT_HACK was using __glutInitWithExit which could not
> be found. The usual two causes to this problem are:
> 1. A library is missing, enter it in the projectsettings or use "#pragma
> comment(lib, ...)" to add it.
> 2. The order of the libraries on the linker commandline is wrong. At least
> for Unix linkers, the libs must come after the libs or objectfiles that
> use
> them.
>
> Uli
>

Another possible cause is that the routines are C and not C++ and therefore
not name-mangled in whichever library they're in. A different extern
declaration would cure this.

Norm

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com