Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. Why can not define _ATL_MIN_CRT in Service Project?

Why can not define _ATL_MIN_CRT in Service Project?

Scheduled Pinned Locked Moved ATL / WTL / STL
questionannouncementworkspace
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    samfromcn
    wrote on last edited by
    #1

    I create a new Windows Service Project. I find there is not _ATL_MIN_CRT in both Unicode Release build configuration. I think it is weird so I added _ATL_MIN_CRT in them. Then building action failed with message "unresolved external symbol _main". why can not define _ATL_MIN_CRT in Win32 Service Project?:doh:

    S 1 Reply Last reply
    0
    • S samfromcn

      I create a new Windows Service Project. I find there is not _ATL_MIN_CRT in both Unicode Release build configuration. I think it is weird so I added _ATL_MIN_CRT in them. Then building action failed with message "unresolved external symbol _main". why can not define _ATL_MIN_CRT in Win32 Service Project?:doh:

      S Offline
      S Offline
      Stuart Dootson
      wrote on last edited by
      #2

      Look at the documentation:

      MSDN wrote:

      Remember that using the _ATL_MIN_CRT macro does not guarantee that no functions from the CRT will be required.
      If you use a function that requires the CRT startup code to operate properly, you will get the following linker error:
      LIBCMT.LIB(crt0.obj) : error LNK2001: unresolved external symbol _main
      Providing your own implementation of _main does not solve this problem: you must either remove reliance on the functions that require the CRT startup code, or you must either statically link the startup code in your image or dynamically link to the CRT.
      When _ATL_MIN_CRT is used without the /GS- compiler option, ATL headers will require the static CRT library.

      What that says is that your service is using C run-time library functions that rely on having the C run-time startup code. Possibly malloc (maybe via new?).

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups