Hi,

I get this warning

yywcsskp.obj : warning LNK4221: no public symbols found; archive member
will be inaccessible

when I compile a static library with VS2005. But the same project with
VS2003 doesn't give this warning.

And this warning seem to cause me problem when I want to link an
application with this library. I got some unresolved external symbol
like this

my_lexer.obj : error LNK2001: unresolved external symbol "public:
virtual void __thiscall yl::yywlexer::yyerror(unsigned short const *)"
(?yyerror@yywlexer@yl@@UAEXPBG@Z)

Can somebody help me ? Is it a VS2005 known bug ?

Eric

Re: warning LNK4221 with VS2005 but not with VS2003 by Eric

Eric
Mon Oct 23 12:41:00 CDT 2006

Eric wrote:
> Hi,
>
> I get this warning
>
> yywcsskp.obj : warning LNK4221: no public symbols found; archive member
> will be inaccessible
>
> when I compile a static library with VS2005. But the same project with
> VS2003 doesn't give this warning.
>
> And this warning seem to cause me problem when I want to link an
> application with this library. I got some unresolved external symbol
> like this
>
> my_lexer.obj : error LNK2001: unresolved external symbol "public:
> virtual void __thiscall yl::yywlexer::yyerror(unsigned short const *)"
> (?yyerror@yywlexer@yl@@UAEXPBG@Z)
>
> Can somebody help me ? Is it a VS2005 known bug ?
>

and why the size of the generated library is very different between
VS2005 and VS2003 ?

2,418 KB (VS2005) vs 1,679 KB (VS2003)

Regards,
Eric


Re: warning LNK4221 with VS2005 but not with VS2003 by Carl

Carl
Mon Oct 23 13:15:02 CDT 2006

"Eric" <clement.eric@gmail.com> wrote in message
news:1161625254.986595.172440@h48g2000cwc.googlegroups.com...
> Eric wrote:
>> Hi,
>>
>> I get this warning
>>
>> yywcsskp.obj : warning LNK4221: no public symbols found; archive member
>> will be inaccessible
>>
>> when I compile a static library with VS2005. But the same project with
>> VS2003 doesn't give this warning.
>>
>> And this warning seem to cause me problem when I want to link an
>> application with this library. I got some unresolved external symbol
>> like this
>>
>> my_lexer.obj : error LNK2001: unresolved external symbol "public:
>> virtual void __thiscall yl::yywlexer::yyerror(unsigned short const *)"
>> (?yyerror@yywlexer@yl@@UAEXPBG@Z)
>>
>> Can somebody help me ? Is it a VS2005 known bug ?

It's likely the result of fixing a bug in 2003, but since you haven't posted
any code, it's impossible to know for sure.

How is yl::yywlexer::yyerror declared? How is the class yl::yywlexer
declared?

> and why the size of the generated library is very different between
> VS2005 and VS2003 ?
>
> 2,418 KB (VS2005) vs 1,679 KB (VS2003)

Probably larger symbol information in the 2005 library. The code itself
shouldn't be larger unless it's a debug build - the 2005 compiler includes
more runtime checks in debug builds than 2003 did.

-cd



Re: warning LNK4221 with VS2005 but not with VS2003 by Eric

Eric
Mon Oct 23 14:23:48 CDT 2006


> How is yl::yywlexer::yyerror declared? How is the class yl::yywlexer
> declared?
>

class yywparser {
public:
yywparser();
virtual ~yywparser();
...
virtual void yyerror(const wchar_t * text);
};

class yywlexer {
public:
yywlexer();
virtual ~yywlexer();
...
virtual void yyerror(const wchar_t * text);
};

-------------------in .cpp ------------------
namespace yl {

void yywparser::yyerror(const wchar_t * text)
{
yyassert(text != NULL);
...
}

}

namespace yl {

void yywlexser::yyerror(const wchar_t * text)
{
yyassert(text != NULL);
...
}

}

Is that help ?


Re: warning LNK4221 with VS2005 but not with VS2003 by Alex

Alex
Mon Oct 23 14:45:22 CDT 2006

"Eric" wrote:
>
>> How is yl::yywlexer::yyerror declared? How is the class
>> yl::yywlexer
>> declared?
>>
>
> class yywparser {
> public:
> yywparser();
> virtual ~yywparser();
> ...
> virtual void yyerror(const wchar_t * text);
> };
>
> class yywlexer {
> public:
> yywlexer();
> virtual ~yywlexer();
> ...
> virtual void yyerror(const wchar_t * text);
> };
>
> -------------------in .cpp ------------------
> namespace yl {
>
> void yywparser::yyerror(const wchar_t * text)
> {
> yyassert(text != NULL);
> ...
> }
>
> }
>
> namespace yl {
>
> void yywlexser::yyerror(const wchar_t * text)
> {
> yyassert(text != NULL);
> ...
> }
>
> }
>
> Is that help ?


Probably stupid question. Are `yywparser' and `yywlexer'
inside `yl' namespace in header file, as well?



Re: warning LNK4221 with VS2005 but not with VS2003 by Eric

Eric
Mon Oct 23 15:25:32 CDT 2006

Thanks for the reply Alex, but my namespace is OK :-)

I just read that the type wchar_t isn't use in the same way by all
compilers.

Maybe there is a difference between VS2003 and VS2005.

I try to compile with /Zc:wchar_t compiler switch (and without) and I
still got the same error.

Regards,
Eric