New vs.net static library project generates LINK errors 
Author Message
 New vs.net static library project generates LINK errors

I create a brand new project in VS.NET using the Win32 Project Type and
specifying a static library.

I then create and add a simple include file and source file that defines
some simple routines that this static library will provide.

When I build the project the file compiles without errors (it is a very
simple test, after all) but then generates a LINK error!!

    LINK : fatal error LNK1561: entry point must be defined

But this is a static library!  I double checked the project settings and
it's still set to build a static library.  There is no Link options in the
project properties, just a Library section.

What's going on???  Thanks in advance.

-- Thomas Brown



Sat, 23 Jul 2005 10:14:25 GMT  
 New vs.net static library project generates LINK errors

Quote:
>I create a brand new project in VS.NET using the Win32 Project Type and
>specifying a static library.

>I then create and add a simple include file and source file that defines
>some simple routines that this static library will provide.

>When I build the project the file compiles without errors (it is a very
>simple test, after all) but then generates a LINK error!!

>    LINK : fatal error LNK1561: entry point must be defined

>But this is a static library!  I double checked the project settings and
>it's still set to build a static library.  There is no Link options in the
>project properties, just a Library section.

>What's going on???  Thanks in advance.

Thomas,

Have you checked the MS Knowledge Base for articles on this error?

Would article 228455 "PRB: Missing /c Compiler Option Causes LNK1561
Linker Error" possibly apply to your situation?

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq



Sat, 23 Jul 2005 15:54:12 GMT  
 New vs.net static library project generates LINK errors


Quote:
> >I create a brand new project in VS.NET using the Win32 Project Type and
> >specifying a static library.

> >I then create and add a simple include file and source file that defines
> >some simple routines that this static library will provide.

> >When I build the project the file compiles without errors (it is a very
> >simple test, after all) but then generates a LINK error!!

> >    LINK : fatal error LNK1561: entry point must be defined

> >But this is a static library!  I double checked the project settings and
> >it's still set to build a static library.  There is no Link options in the
> >project properties, just a Library section.

> >What's going on???  Thanks in advance.

> Thomas,

> Have you checked the MS Knowledge Base for articles on this error?

> Would article 228455 "PRB: Missing /c Compiler Option Causes LNK1561
> Linker Error" possibly apply to your situation?

> Dave

Well, using the new VS.NET integrated help I pressed F1 with the error
message selected and it returned an MSDN search page saying that no
items were found for that error message.

Plus, this specific KB entry doesn't quite seem to apply...  1) it deals
with VS 6.0 and I'm not having a problem in that environment, but in the
new VS.NET, and 2) it deals with a project used to only create a
precompiled header whereas I'm dealing with one of the (supposedly)
directly supported options to build a static library.

That said, however, I am not (unfortunately) at my same computer today
and cannot check the command line options to see if /c has been set for
the source files.  I'll bet you're right and that it is not present.  If
that is the case then this is pretty bogus little bug in VS.NET!!!!

-- Thomas Brown



Sun, 24 Jul 2005 00:16:00 GMT  
 New vs.net static library project generates LINK errors

Quote:
> >I create a brand new project in VS.NET using the Win32 Project Type and
> >specifying a static library.

> >I then create and add a simple include file and source file that defines
> >some simple routines that this static library will provide.

> >When I build the project the file compiles without errors (it is a very
> >simple test, after all) but then generates a LINK error!!

> >    LINK : fatal error LNK1561: entry point must be defined

> >But this is a static library!  I double checked the project settings and
> >it's still set to build a static library.  There is no Link options in
the
> >project properties, just a Library section.

> >What's going on???  Thanks in advance.

> Thomas,

> Have you checked the MS Knowledge Base for articles on this error?

> Would article 228455 "PRB: Missing /c Compiler Option Causes LNK1561
> Linker Error" possibly apply to your situation?

> Dave
> --
> MVP VC++ FAQ: http://www.mvps.org/vcfaq

No.  Now that I've triple checked.  The command line for the project (and
properly inherited for the individual source file) has the "/c" flag to
indicate compile-only.

Yet the project continues to try and link and generates errors.

Please, what am I missing?!?

-- Thomas Brown



Mon, 25 Jul 2005 03:58:06 GMT  
 New vs.net static library project generates LINK errors
Ok,

I figured out the problem I was having building a static library...

It turns out that the old, VC6.0 project I was trying to bring over had some
preprocessor definitions it needed in project settings and I was keeping
these even when trying to reproduce the problem with a brand new, simple
project.

Among these definitions was:

    FOO=""

i.e. define FOO to be an empty string.

Well..., reading the docs it looks like quotes in the /D options are a no-no
and are stripped.  But it really appears that the problem is more subtle and
bogus than that.  It looks like VS .NET encloses all the /D options in
double quotes and the embedded double quote is somehow throwing off CL to
the point where it must be simply failing to parse the rest of the command
line, including the eventual /c switch, and therefore tries to compile and
link instead of just compile!

-- Thomas Brown


Quote:


> > >I create a brand new project in VS.NET using the Win32 Project Type and
> > >specifying a static library.

> > >I then create and add a simple include file and source file that
defines
> > >some simple routines that this static library will provide.

> > >When I build the project the file compiles without errors (it is a very
> > >simple test, after all) but then generates a LINK error!!

> > >    LINK : fatal error LNK1561: entry point must be defined

> > >But this is a static library!  I double checked the project settings
and
> > >it's still set to build a static library.  There is no Link options in
> the
> > >project properties, just a Library section.

> > >What's going on???  Thanks in advance.

> > Thomas,

> > Have you checked the MS Knowledge Base for articles on this error?

> > Would article 228455 "PRB: Missing /c Compiler Option Causes LNK1561
> > Linker Error" possibly apply to your situation?

> > Dave
> > --
> > MVP VC++ FAQ: http://www.mvps.org/vcfaq

> No.  Now that I've triple checked.  The command line for the project (and
> properly inherited for the individual source file) has the "/c" flag to
> indicate compile-only.

> Yet the project continues to try and link and generates errors.

> Please, what am I missing?!?

> -- Thomas Brown



Mon, 25 Jul 2005 05:15:41 GMT  
 New vs.net static library project generates LINK errors

Quote:
>I figured out the problem I was having building a static library...
>...

Thomas,

FWIW, I can reproduce the same problem doing what you say.

I'll try to bring it to the attention of MS in case there's something
that can be done about it in the future.

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq



Tue, 26 Jul 2005 04:33:46 GMT  
 New vs.net static library project generates LINK errors


Quote:
> >I figured out the problem I was having building a static library...
> >...

> Thomas,

> FWIW, I can reproduce the same problem doing what you say.

> I'll try to bring it to the attention of MS in case there's something
> that can be done about it in the future.

> Dave

Thanks Dave,

It was nice to figure that one out.  It was causing my other error too
(the warning about exception handling) because the /EHsc flag was also
getting missed.

-- Thomas Brown



Tue, 26 Jul 2005 06:37:03 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. New vs.net static library project generates LINK errors

2. Linking Error - Static vs. Non-Static

3. Problem linking a VC generated static LIB into a win32 DLL project

4. VC 4.2 link error linking static libraries from VC 6.0

5. changing existing dynamic library project to static library project

6. Compile error on generated ActiveX MFC wrapper class ( VC++7, VS.NET 2002 )

7. DLL vs. Static Link Library

8. Static link MFC DLL in VS.NET

9. Printing problem when static linking MFC in VS.net

10. VS.net MFC running on Windows 95, 98 static linking problem

11. Static vs Dynamic link of MFC library

12. How to convert dynamic link library project to static link library project?

 

 
Powered by phpBB® Forum Software