problems while linking in MFc app

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rama

    problems while linking in MFc app

    HI,
    I have a win32 application that works okay but when i use the same
    classes in a MFC application , i am faced with problems. I am
    including a library into the MFC applicationand compilation goes fine.
    Please let me know what is wrong.

    Errors:

    Linking...
    msvcirtd.lib(MS VCIRTD.dll) : error LNK2005: "public: class ostream &
    __thiscall ostream::operat or<<(class ostream & (__cdecl*)(clas s
    ostream &))" (??6ostream@@QA EAAV0@P6AAAV0@A AV0@@Z@Z) already defined
    in improv-2.3.1.lib(Optio ns.obj)
    libci.lib(_ios. obj) : error LNK2005: "protected: __thiscall
    ios::ios(void)" (??0ios@@IAE@XZ ) already defined in
    msvcirtd.lib(MS VCIRTD.dll)
    libci.lib(_ios. obj) : error LNK2005: "public: virtual __thiscall
    ios::~ios(void) " (??1ios@@UAE@XZ ) already defined in
    msvcirtd.lib(MS VCIRTD.dll)
    libci.lib(ostre am.obj) : error LNK2005: "public: class ostream &
    __thiscall ostream::operat or<<(char const *)"
    (??6ostream@@QA EAAV0@PBD@Z) already defined in
    msvcirtd.lib(MS VCIRTD.dll)
    libci.lib(ostre am.obj) : error LNK2005: "public: class ostream &
    __thiscall ostream::flush( void)" (?flush@ostream @@QAEAAV1@XZ) already
    defined in msvcirtd.lib(MS VCIRTD.dll)
    LIBC.lib(crt0da t.obj) : error LNK2005: _exit already defined in
    msvcrtd.lib(MSV CRTD.dll)
    LIBC.lib(crt0da t.obj) : error LNK2005: __exit already defined in
    msvcrtd.lib(MSV CRTD.dll)
    LIBC.lib(crt0in it.obj) : error LNK2005: ___xc_z already defined in
    msvcrtd.lib(cin itexe.obj)
    LIBC.lib(crt0in it.obj) : error LNK2005: ___xc_a already defined in
    msvcrtd.lib(cin itexe.obj)
    LIBC.lib(crt0in it.obj) : error LNK2005: ___xi_z already defined in
    msvcrtd.lib(cin itexe.obj)
    LIBC.lib(crt0in it.obj) : error LNK2005: ___xi_a already defined in
    msvcrtd.lib(cin itexe.obj)
    msvcrtd.lib(MSV CRTD.dll) : error LNK2005: __setmbcp already defined in
    LIBC.lib(mbctyp e.obj)
    LINK : warning LNK4098: defaultlib "msvcrtd.li b" conflicts with use of
    other libs; use /NODEFAULTLIB:li brary
    LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other
    libs; use /NODEFAULTLIB:li brary
    midi2text.obj : error LNK2001: unresolved external symbol "private:
    void __thiscall midi2text::exam ple(void)" (?example@midi2 text@@AAEXXZ)
    midiGUI.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.

    midiGUI.exe - 14 error(s), 2 warning(s)

    Thanks,
    Meera
  • John Harrison

    #2
    Re: problems while linking in MFc app


    "rama" <meera_gn@hotma il.com> wrote in message
    news:ee0c6021.0 309050157.2218a 3fc@posting.goo gle.com...[color=blue]
    > HI,
    > I have a win32 application that works okay but when i use the same
    > classes in a MFC application , i am faced with problems. I am
    > including a library into the MFC applicationand compilation goes fine.
    > Please let me know what is wrong.
    >
    > Errors:
    >
    > Linking...
    > msvcirtd.lib(MS VCIRTD.dll) : error LNK2005: "public: class ostream &
    > __thiscall ostream::operat or<<(class ostream & (__cdecl*)(clas s
    > ostream &))" (??6ostream@@QA EAAV0@P6AAAV0@A AV0@@Z@Z) already defined
    > in improv-2.3.1.lib(Optio ns.obj)[/color]

    [snip]

    This is caused by having the wrong compiler options set when you compile.
    For advice on how to operate your compiler you should ask in a compiler
    group, this is not a language issue (which is what we discuss here). Try
    news:microsoft. public.vc.langu age or
    news:comp.os.ms-windows.program mer.tools.mfc for instance.

    john


    Comment

    • John Harrison

      #3
      Re: problems while linking in MFc app

      >[color=blue]
      > This is caused by having the wrong compiler options set when you compile.[/color]

      I should say, having different compiler options when you compile your
      library, from the compiler options you use when you compile your
      application.

      john


      Comment

      • Alex Sedow

        #4
        Re: problems while linking in MFc app

        1. Try add to "project properties/linker/input/ignore libraries": libc,
        nafxcw
        2. Try /Force option.

        Alex

        "rama" <meera_gn@hotma il.com> wrote in message
        news:ee0c6021.0 309050157.2218a 3fc@posting.goo gle.com...[color=blue]
        > HI,
        > I have a win32 application that works okay but when i use the same
        > classes in a MFC application , i am faced with problems. I am
        > including a library into the MFC applicationand compilation goes fine.
        > Please let me know what is wrong.
        >
        > Errors:
        >
        > Linking...
        > msvcirtd.lib(MS VCIRTD.dll) : error LNK2005: "public: class ostream &
        > __thiscall ostream::operat or<<(class ostream & (__cdecl*)(clas s
        > ostream &))" (??6ostream@@QA EAAV0@P6AAAV0@A AV0@@Z@Z) already defined
        > in improv-2.3.1.lib(Optio ns.obj)
        > libci.lib(_ios. obj) : error LNK2005: "protected: __thiscall
        > ios::ios(void)" (??0ios@@IAE@XZ ) already defined in
        > msvcirtd.lib(MS VCIRTD.dll)
        > libci.lib(_ios. obj) : error LNK2005: "public: virtual __thiscall
        > ios::~ios(void) " (??1ios@@UAE@XZ ) already defined in
        > msvcirtd.lib(MS VCIRTD.dll)
        > libci.lib(ostre am.obj) : error LNK2005: "public: class ostream &
        > __thiscall ostream::operat or<<(char const *)"
        > (??6ostream@@QA EAAV0@PBD@Z) already defined in
        > msvcirtd.lib(MS VCIRTD.dll)
        > libci.lib(ostre am.obj) : error LNK2005: "public: class ostream &
        > __thiscall ostream::flush( void)" (?flush@ostream @@QAEAAV1@XZ) already
        > defined in msvcirtd.lib(MS VCIRTD.dll)
        > LIBC.lib(crt0da t.obj) : error LNK2005: _exit already defined in
        > msvcrtd.lib(MSV CRTD.dll)
        > LIBC.lib(crt0da t.obj) : error LNK2005: __exit already defined in
        > msvcrtd.lib(MSV CRTD.dll)
        > LIBC.lib(crt0in it.obj) : error LNK2005: ___xc_z already defined in
        > msvcrtd.lib(cin itexe.obj)
        > LIBC.lib(crt0in it.obj) : error LNK2005: ___xc_a already defined in
        > msvcrtd.lib(cin itexe.obj)
        > LIBC.lib(crt0in it.obj) : error LNK2005: ___xi_z already defined in
        > msvcrtd.lib(cin itexe.obj)
        > LIBC.lib(crt0in it.obj) : error LNK2005: ___xi_a already defined in
        > msvcrtd.lib(cin itexe.obj)
        > msvcrtd.lib(MSV CRTD.dll) : error LNK2005: __setmbcp already defined in
        > LIBC.lib(mbctyp e.obj)
        > LINK : warning LNK4098: defaultlib "msvcrtd.li b" conflicts with use of
        > other libs; use /NODEFAULTLIB:li brary
        > LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other
        > libs; use /NODEFAULTLIB:li brary
        > midi2text.obj : error LNK2001: unresolved external symbol "private:
        > void __thiscall midi2text::exam ple(void)" (?example@midi2 text@@AAEXXZ)
        > midiGUI.exe : fatal error LNK1120: 1 unresolved externals
        > Error executing link.exe.
        >
        > midiGUI.exe - 14 error(s), 2 warning(s)
        >
        > Thanks,
        > Meera[/color]


        Comment

        Working...