ERROR: Unresolved External Symbol _main with ADO 2.5 & ATL Release Build 
Author Message
 ERROR: Unresolved External Symbol _main with ADO 2.5 & ATL Release Build

I have a small ATL dll that I have written that uses ADO 2.5 to access a
database.  The dll compiles fine as a debug build, however when I try to
perform a release build, it fails with linker error:

LNK2001: unresolved external symbol _main

Could anyone help me out with how to get around this?

Thanks,
Brian Griffin



Wed, 26 Feb 2003 12:54:50 GMT  
 ERROR: Unresolved External Symbol _main with ADO 2.5 & ATL Release Build

Greets,

    You are using a library function that requires the CRT startup code.
MinSize ATL projects try to eliminate unneeded CRT code if it is not
necessary.  In the event you do end up linking with the CRT startups, they
require the main() entry point to be defined.  There are two possible
solutions to fix this, it is your choice:

    1) remove the library code that requires the CRT startup code and
replace it with equivalent Win32 API calls;
    2) (and the easiest) remove the "_ATL_MIN_CRT" preprocessor definition
from your project's settings.

Regards,

Joe


Quote:
> I have a small ATL dll that I have written that uses ADO 2.5 to access a
> database.  The dll compiles fine as a debug build, however when I try to
> perform a release build, it fails with linker error:

> LNK2001: unresolved external symbol _main

> Could anyone help me out with how to get around this?

> Thanks,
> Brian Griffin



Wed, 26 Feb 2003 19:52:29 GMT  
 ERROR: Unresolved External Symbol _main with ADO 2.5 & ATL Release Build
Hi Joe,

Thanks for the help.  What I find interesting is that I am not using
anything that I was aware of in the CRT.

It is a simple dataserver dll that is 90% ADO code.  The only non-ADO
elements that I use are HRESULTs and the instrinsic HRESULT constants (S_OK,
E_FAIL, etc), _bstr_t, __uuidof( ), and BSTR.

I found a KB article that indicates that the CRT is required for a global
object with a constructor.  I have a generic class that implements a
constructor, and suspect that this is the cause of the CRT dependency.

Does this sound reasonable?

Thanks again for your help,
Brian Griffin


Quote:
> Greets,

>     You are using a library function that requires the CRT startup code.
> MinSize ATL projects try to eliminate unneeded CRT code if it is not
> necessary.  In the event you do end up linking with the CRT startups, they
> require the main() entry point to be defined.  There are two possible
> solutions to fix this, it is your choice:

>     1) remove the library code that requires the CRT startup code and
> replace it with equivalent Win32 API calls;
>     2) (and the easiest) remove the "_ATL_MIN_CRT" preprocessor definition
> from your project's settings.

> Regards,

> Joe



> > I have a small ATL dll that I have written that uses ADO 2.5 to access a
> > database.  The dll compiles fine as a debug build, however when I try to
> > perform a release build, it fails with linker error:

> > LNK2001: unresolved external symbol _main

> > Could anyone help me out with how to get around this?

> > Thanks,
> > Brian Griffin



Wed, 26 Feb 2003 21:46:17 GMT  
 ERROR: Unresolved External Symbol _main with ADO 2.5 & ATL Release Build
Yes, you do need the CRT for global (or function-level static) objects
that have constructors.  But that's not all you need the CRT for.  If
you want C++ exceptions, you must have it also.

That means that if  the way you gain access to the ADO interfaces is
though #import, and you do NOT go out of your way to avoid the wrapper
functions it creates for you (in the .TLI file) you must have the CRT
present.  Those wrapper functions throw C++ exceptions upon COM
errors.

Joe O'  (another Joe)

"Brian Griffin" wrote

Quote:
> Hi Joe,

> Thanks for the help.  What I find interesting is that I am not using
> anything that I was aware of in the CRT.

> I found a KB article that indicates that the CRT is required for a
global
> object with a constructor.  I have a generic class that implements a
> constructor, and suspect that this is the cause of the CRT
dependency.

> "Joe Delekto"wrote
> > Greets,

> >     You are using a library function that requires the CRT startup
code.

> > "Brian Griffin"wrote
> > > I have a small ATL dll that I have written that uses ADO 2.5 to
access a
> > > database.  The dll compiles fine as a debug build, however when
I try to
> > > perform a release build, it fails with linker error:

> > > LNK2001: unresolved external symbol _main

> > > Could anyone help me out with how to get around this?



Thu, 27 Feb 2003 02:43:40 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. ATL DLL Release Build: unresolved external symbol _main

2. release build error LNK2001: unresolved external symbol _main

3. release build: unresolved external symbol _main caused by an import .tlb

4. Unresolved external symbol _main when compiling Release MinSize

5. Creating Release DLL -- unresolved external symbol _main

6. Debug build ok, release - unresolved external _main

7. Unresolved external "_main" in Release Build

8. Linking error 2019 unresolved external symbol _main when porting to .NET

9. Linking error 2019 unresolved external symbol _main ...

10. Error LNK20001 unresolved external symbol main.

11. Linking Problem when trying to create ReleaseUMinDependency[error LNK2001: unresolved external symbol _main]

12. error LNK2001: unresolved external symbol _main

 

 
Powered by phpBB® Forum Software