CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 1999
    Location
    Colorado, USA
    Posts
    1,002

    Statically link CRT

    MSDN notes "set the Minimize CRT Use in ATL option to No and link to the CRT either statically or dynamically". I have MSVC++6.0, SP5. Could they be referring to an interface in 7.0? Can someone tell me what to insert in project options to statically link the CRT?

    Background:
    I've got an ActiveX control (no MFC) in a DLL. Debug version runs fine in Test container and in IE. So...I went to build the release version and ... pass the aspirin! I got an "unresolved external symbol _main". I looked that up in MSDN which explained the error involving the use of the CRT. I built the project again with /VERBOSE turned on and the build output showed that I had too many fxns needing the CRT. I took _ATL_MIN_CRT out of the project options. I thought this would statically link the CRT (I can afford the extra 25K) but evidently it doesn't. I don't have _CRT_MIN_SIZE defined in project options. I do have _ATL_STATIC_REGISTRY defined.

    Thanks,
    Steve

  2. #2
    Join Date
    Sep 2003
    Location
    Forever Gone... For Now...
    Posts
    1,515

    Re: Statically link CRT

    Originally posted by sstofka
    Can someone tell me what to insert in project options to statically link the CRT?
    Project | Settings | C/C++ | Code Generation | Use runtime library
    Thought for the day/week/month/year:
    Windows System Error 4006:
    Replication with a nonconfigured partner is not allowed.

  3. #3
    Join Date
    Sep 1999
    Location
    Colorado, USA
    Posts
    1,002
    The "Use Runtime Library" in the project is set to "Multithreaded". I tried "Single Threaded" and "MultiThreaded DLL" but they both want an entry point. When I specified /ENTRYllMain in project options, linker disregarded /ENTRY - didn't know what it meant. (MSDN recommends letting the linker choose the entry point if subsystem:windows is defined - which it is in my project). BTW, the original project settings which generated this "_main" error were all generated by default by the ATL Com Wizard.

    Any further clarification? Thanks.

    Steve

  4. #4
    Join Date
    Sep 2003
    Location
    Forever Gone... For Now...
    Posts
    1,515
    Originally posted by sstofka
    but they both want an entry point
    What do you mean by this?
    Perhaps the simplest thing would be if you could post your project?
    Thought for the day/week/month/year:
    Windows System Error 4006:
    Replication with a nonconfigured partner is not allowed.

  5. #5
    Join Date
    Sep 1999
    Location
    Colorado, USA
    Posts
    1,002
    I got it. libcmt.lib has to be the first in the library links. What confused me is that the debug version ran fine without including the libcmt.lib at all. Perhaps the Debug version automatically links with the libcmt. At any rate, the release version is linking and running fine.

    Thanks,
    Steve

  6. #6
    Join Date
    Sep 2003
    Location
    Forever Gone... For Now...
    Posts
    1,515
    Originally posted by sstofka
    At any rate, the release version is linking and running fine.
    Cool.

    Actually, the debug version should be bringing in libcmtd.lib (for the debug static multithreaded CRT).
    Thought for the day/week/month/year:
    Windows System Error 4006:
    Replication with a nonconfigured partner is not allowed.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured