Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Little help with a Visual Studio linker error?

24 views
Skip to first unread message

Noob

unread,
Dec 1, 2015, 7:10:53 PM12/1/15
to
Hi there.

I know this is a forum for C++ and not VS but I hope this is an error
you will find easy to recognize.

I have a small VS Solution containing a static library project and an
executable. When I try to build it all I receive gigantic error
messages. The messages mention things like "__penter", "__pexit",
"__thiscall" and I'm afraid I have no idea what they are.

I'm going to post the messages below hoping that they will be
meaningful to someone willing to give me a little hand here.



testlib.lib(rule_params.obj) : error LNK2019: unresolved external symbol
__penter referenced in function "public: __thiscall std::pair<class
std::_Tree_iterator<class std::_Tree_val<struct
std::_Tree_simple_types<struct std::pair<unsigned int const ,class
std::tuple<class std::vector<double,class std::allocator<double> >,class
std::vector<double,class std::allocator<double> >,class
std::vector<double,class std::allocator<double> > > > > >
>,bool>::pair<class std::_Tree_iterator<class std::_Tree_val<struct
std::_Tree_simple_types<struct std::pair<unsigned int const ,class
std::tuple<class std::vector<double,class std::allocator<double> >,class
std::vector<double,class std::allocator<double> >,class
std::vector<double,class std::allocator<double> > > > > > >,bool><class
std::_Tree_iterator<class std::_Tree_val<struct
std::_Tree_simple_types<struct std::pair<unsigned int const ,class
std::tuple<class std::vector<double,class std::allocator<double> >,class
std::vector<double,class std::allocator<double> >,class
std::vector<double,class std::allocator<double> > > > > > >
&,bool,void>(class std::_Tree_iterator<class std::_Tree_val<struct
std::_Tree_simple_types<struct std::pair<unsigned int const ,class
std::tuple<class std::vector<double,class std::allocator<double> >,class
std::vector<double,class std::allocator<double> >,class
std::vector<double,class std::allocator<double> > > > > > > &,bool &&)"
(??$?0AAV?$_Tree_iterator@V?$_Tree_val@U?$_Tree_simple_types@U?$pair@$$CBIV?$tuple@V?$vector@NV?$allocator@N@std@@@std@@V12@V12@@std@@@std@@@std@@@std@@@std@@_NX@?$pair@V?$_Tree_iterator@V?$_Tree_val@U?$_Tree_simple_types@U?$pair@$$CBIV?$tuple@V?$vector@NV?$allocator@N@std@@@std@@V12@V12@@std@@@std@@@std@@@std@@@std@@_N@std@@QAE@AAV?$_Tree_iterator@V?$_Tree_val@U?$_Tree_simple_types@U?$pair@$$CBIV?$tuple@V?$vector@NV?$allocator@N@std@@@std@@V12@V12@@std@@@std@@@std@@@std@@@1@$$QA_N@Z)

testlib.lib(stdafx.obj) : error LNK2001: unresolved external symbol __penter

testlib.lib(rule_params.obj) : error LNK2019: unresolved external symbol
__pexit referenced in function "public: __thiscall std::pair<class
std::_Tree_iterator<class std::_Tree_val<struct
std::_Tree_simple_types<struct std::pair<unsigned int const ,class
std::tuple<class std::vector<double,class std::allocator<double> >,class
std::vector<double,class std::allocator<double> >,class
std::vector<double,class std::allocator<double> > > > > >
>,bool>::pair<class std::_Tree_iterator<class std::_Tree_val<struct
std::_Tree_simple_types<struct std::pair<unsigned int const ,class
std::tuple<class std::vector<double,class std::allocator<double> >,class
std::vector<double,class std::allocator<double> >,class
std::vector<double,class std::allocator<double> > > > > > >,bool><class
std::_Tree_iterator<class std::_Tree_val<struct
std::_Tree_simple_types<struct std::pair<unsigned int const ,class
std::tuple<class std::vector<double,class std::allocator<double> >,class
std::vector<double,class std::allocator<double> >,class
std::vector<double,class std::allocator<double> > > > > > >
&,bool,void>(class std::_Tree_iterator<class std::_Tree_val<struct
std::_Tree_simple_types<struct std::pair<unsigned int const ,class
std::tuple<class std::vector<double,class std::allocator<double> >,class
std::vector<double,class std::allocator<double> >,class
std::vector<double,class std::allocator<double> > > > > > > &,bool &&)"
(??$?0AAV?$_Tree_iterator@V?$_Tree_val@U?$_Tree_simple_types@U?$pair@$$CBIV?$tuple@V?$vector@NV?$allocator@N@std@@@std@@V12@V12@@std@@@std@@@std@@@std@@@std@@_NX@?$pair@V?$_Tree_iterator@V?$_Tree_val@U?$_Tree_simple_types@U?$pair@$$CBIV?$tuple@V?$vector@NV?$allocator@N@std@@@std@@V12@V12@@std@@@std@@@std@@@std@@@std@@_N@std@@QAE@AAV?$_Tree_iterator@V?$_Tree_val@U?$_Tree_simple_types@U?$pair@$$CBIV?$tuple@V?$vector@NV?$allocator@N@std@@@std@@V12@V12@@std@@@std@@@std@@@std@@@1@$$QA_N@Z)

testlib.lib(stdafx.obj) : error LNK2001: unresolved external symbol __pexit

Noob

unread,
Dec 1, 2015, 7:14:37 PM12/1/15
to
I forgot to mention this is VS 2015.

Whups

unread,
Dec 1, 2015, 7:25:05 PM12/1/15
to
On 2015-12-02 00:10:29 +0000, Noob said:

> Hi there.
>
> I know this is a forum for C++ and not VS but I hope this is an error
> you will find easy to recognize.
>
> I have a small VS Solution containing a static library project and an
> executable. When I try to build it all I receive gigantic error
> messages. The messages mention things like "__penter", "__pexit",
> "__thiscall" and I'm afraid I have no idea what they are.
>
> I'm going to post the messages below hoping that they will be
> meaningful to someone willing to give me a little hand here.
>
>

[snip]

>
> testlib.lib(stdafx.obj) : error LNK2001: unresolved external symbol __penter

_penter is affected by the /Gh compiler switch.
https://msdn.microsoft.com/en-us/library/c63a9b7h.aspx


[snip]

>
> testlib.lib(stdafx.obj) : error LNK2001: unresolved external symbol __pexit

-pexit is affected by the /GH compiler switch.
https://msdn.microsoft.com/en-us/library/xc11y76y.aspx

Is your project setting these? I can't think of a reason why these
would be set unless the author of the project intended to create custom
preamble and postamble code for the affected functions.

Noob

unread,
Dec 1, 2015, 7:28:48 PM12/1/15
to
OK, I should have done my homework better.

In the configuration properties for my static library,
I had the options /GH and /Gh listed under "additional
options". I don't know how they got there but it looks
like this was the root of the problem:

https://msdn.microsoft.com/en-us/library/c63a9b7h.aspx
https://msdn.microsoft.com/en-us/library/xc11y76y.aspx

Also, I already sort of know what __this call is:

https://msdn.microsoft.com/en-us/library/ek8tkfbw.aspx

Thanks and sorry for the mess. It's about time I stop
for today and go play some Half Life 2...


Noob

unread,
Dec 1, 2015, 7:31:04 PM12/1/15
to
Ahh, thank you. I had found this just after I posted. Thank you very
much in any case. Yes, I have no idea how those options were set in
first place. Now the mess is gone. Cheers!
0 new messages