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. C / C++ / MFC
  4. Linking Problem !! Something to do with Multi-threading

Linking Problem !! Something to do with Multi-threading

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++comdebugging
3 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.
  • M Offline
    M Offline
    Mohammad Tarik
    wrote on last edited by
    #1

    I was trying to includeThe nFS Library[^] in my project, but I couldn't do it like the demo application, where he didn't include neither the .h files nor the .lib file into the project.:wtf: When I tried to recompile my program with including all the .h and .cpp files of the libraries it worked. :) Since my project is already full with files, so I removed all these files, and included only the .lib file, and recompiled the program. and I got the following error :confused: LIBCMT.lib(crt0.obj) : error LNK2005: __amsg_exit already defined in msvcrtd.lib(MSVCR70D.dll) LIBCMT.lib(crt0dat.obj) : error LNK2005: _exit already defined in msvcrtd.lib(MSVCR70D.dll) LIBCMT.lib(crt0dat.obj) : error LNK2005: __exit already defined in msvcrtd.lib(MSVCR70D.dll) LIBCMT.lib(crt0dat.obj) : error LNK2005: __cexit already defined in msvcrtd.lib(MSVCR70D.dll) LIBCMT.lib(crt0dat.obj) : error LNK2005: __c_exit already defined in msvcrtd.lib(MSVCR70D.dll) LIBCMT.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in msvcrtd.lib(MSVCR70D.dll) LIBCMT.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in msvcrtd.lib(cinitexe.obj) LIBCMT.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in msvcrtd.lib(cinitexe.obj) LIBCMT.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in msvcrtd.lib(cinitexe.obj) LIBCMT.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in msvcrtd.lib(cinitexe.obj) msvcrtd.lib(MSVCR70D.dll) : error LNK2005: __setmbcp already defined in LIBCMT.lib(mbctype.obj) LINK : warning LNK4098: defaultlib 'msvcrtd.lib' conflicts with use of other libs; use /NODEFAULTLIB:library LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library LIBCMT.lib(crt0.obj) : error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup Debug/Trial.exe : fatal error LNK1120: 1 unresolved externals When I put /NODEFAULTLIB:LIBCMT, it works fine. But I will need multi-threading for an even more important Library. :doh: So, what are the consequences of adding that line to the commandline of Linker....... and what can I do to solve my problem without having to add it. Do I have to go back to adding all the .h and .cpp files of the library.... or:doh:. Please help. :(( :rose:

    T 1 Reply Last reply
    0
    • M Mohammad Tarik

      I was trying to includeThe nFS Library[^] in my project, but I couldn't do it like the demo application, where he didn't include neither the .h files nor the .lib file into the project.:wtf: When I tried to recompile my program with including all the .h and .cpp files of the libraries it worked. :) Since my project is already full with files, so I removed all these files, and included only the .lib file, and recompiled the program. and I got the following error :confused: LIBCMT.lib(crt0.obj) : error LNK2005: __amsg_exit already defined in msvcrtd.lib(MSVCR70D.dll) LIBCMT.lib(crt0dat.obj) : error LNK2005: _exit already defined in msvcrtd.lib(MSVCR70D.dll) LIBCMT.lib(crt0dat.obj) : error LNK2005: __exit already defined in msvcrtd.lib(MSVCR70D.dll) LIBCMT.lib(crt0dat.obj) : error LNK2005: __cexit already defined in msvcrtd.lib(MSVCR70D.dll) LIBCMT.lib(crt0dat.obj) : error LNK2005: __c_exit already defined in msvcrtd.lib(MSVCR70D.dll) LIBCMT.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in msvcrtd.lib(MSVCR70D.dll) LIBCMT.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in msvcrtd.lib(cinitexe.obj) LIBCMT.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in msvcrtd.lib(cinitexe.obj) LIBCMT.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in msvcrtd.lib(cinitexe.obj) LIBCMT.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in msvcrtd.lib(cinitexe.obj) msvcrtd.lib(MSVCR70D.dll) : error LNK2005: __setmbcp already defined in LIBCMT.lib(mbctype.obj) LINK : warning LNK4098: defaultlib 'msvcrtd.lib' conflicts with use of other libs; use /NODEFAULTLIB:library LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library LIBCMT.lib(crt0.obj) : error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup Debug/Trial.exe : fatal error LNK1120: 1 unresolved externals When I put /NODEFAULTLIB:LIBCMT, it works fine. But I will need multi-threading for an even more important Library. :doh: So, what are the consequences of adding that line to the commandline of Linker....... and what can I do to solve my problem without having to add it. Do I have to go back to adding all the .h and .cpp files of the library.... or:doh:. Please help. :(( :rose:

      T Offline
      T Offline
      Taka Muraoka
      wrote on last edited by
      #2

      This happens when you try to link things together that have been compiled with different settings. Go through *every* single library that you are linking in and make sure you are using the correct one i.e. multi-threaded. You also need to check the DLL/not-DLL switches are all the same as well.


      Lets be honest, isn't it amazing how many truly stupid people you meet during the course of the day. Carry around a pad and pencil, you'll have twenty or thirty names by the end of the day - George Carlin Awasu 2.1.1 [^]: A free RSS reader with support for Code Project.

      M 1 Reply Last reply
      0
      • T Taka Muraoka

        This happens when you try to link things together that have been compiled with different settings. Go through *every* single library that you are linking in and make sure you are using the correct one i.e. multi-threaded. You also need to check the DLL/not-DLL switches are all the same as well.


        Lets be honest, isn't it amazing how many truly stupid people you meet during the course of the day. Carry around a pad and pencil, you'll have twenty or thirty names by the end of the day - George Carlin Awasu 2.1.1 [^]: A free RSS reader with support for Code Project.

        M Offline
        M Offline
        Mohammad Tarik
        wrote on last edited by
        #3

        Thanks It worked fine. :rose:

        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