VC++ error

This is a discussion on VC++ error within the Windows Programming forums, part of the Platform Specific Boards category; I get this error when compiling something in VC++6 LIBCMT.lib(osfinfo.obj) : error LNK2005: __alloc_osfhnd already defined in LIBCD.lib(osfinfo.obj) LIBCMT.lib(osfinfo.obj) : ...

  1. #1
    using namespace Trooper; St0rmTroop3er's Avatar
    Join Date
    Sep 2003
    Posts
    77

    VC++ error

    I get this error when compiling something in VC++6

    LIBCMT.lib(osfinfo.obj) : error LNK2005: __alloc_osfhnd already defined in LIBCD.lib(osfinfo.obj)
    LIBCMT.lib(osfinfo.obj) : error LNK2005: __set_osfhnd already defined in LIBCD.lib(osfinfo.obj)
    LIBCMT.lib(osfinfo.obj) : error LNK2005: __free_osfhnd already defined in LIBCD.lib(osfinfo.obj)
    LIBCMT.lib(osfinfo.obj) : error LNK2005: __get_osfhandle already defined in LIBCD.lib(osfinfo.obj)
    LIBCMT.lib(osfinfo.obj) : error LNK2005: __open_osfhandle already defined in LIBCD.lib(osfinfo.obj)
    LIBCMT.lib(dosmap.obj) : error LNK2005: __dosmaperr already defined in LIBCD.lib(dosmap.obj)
    LINK : warning LNK4098: defaultlib "LIBCMT" conflicts with use of other libs; use /NODEFAULTLIB:library
    Debug/main.exe : fatal error LNK1169: one or more multiply defined symbols found
    Error executing link.exe.
    Any idea what it means?

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,246
    For some reason you appear to be linking to the multi-threaded CRT library, and the debug single-threaded CRT library. You can only link to one CRT library per project. You either have a #pragma statement telling your compiler to link to a CRT, or you added a CRT .lib file to the project link options. In either case, this is the wrong way to select which CRT to use for your project. The correct way is to go to project settings, then click on the "C/C++" tab. From there select "code generation" from the category drop-down box, then select the CRT you want from the "Use run-time library" drop down.

  3. #3
    using namespace Trooper; St0rmTroop3er's Avatar
    Join Date
    Sep 2003
    Posts
    77
    ok, I figured it out. Thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Testing some code, lots of errors...
    By Sparrowhawk in forum C Programming
    Replies: 48
    Last Post: 12-15-2008, 03:09 AM
  3. how do you resolve this error?
    By -EquinoX- in forum C Programming
    Replies: 32
    Last Post: 11-05-2008, 03:35 PM
  4. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  5. Crazy errors caused by class, never seen before..
    By Shamino in forum C++ Programming
    Replies: 2
    Last Post: 06-10-2007, 11:54 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21