LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value...












0















im trying to compile essnac-ng library from github with msvc2017 to use in an already existing qt-Project.



I managed to compile it using msys2 (with make, autoconf, automake, yacc, bison) and powershell:



cmd.exe /k "C:Program Files (x86)Microsoft Visual Studio2017CommunityVCAuxiliaryBuildvcvarsall.bat" x86 `& powershell
cd D:Projekteesnacc-ng
bash ./boot.sh
bash ./configure LD=linker.exe
make
make install


Problem 1: it is only compiling the static libraries with the following warning during make:



warning: undefined symbols not allowed in x86_64-pc-msys shared libraries; building static only


after trying what this thread here says:
libtool: undefined symbols not allowed in i686-pc-mingw32 shared
i get an error during make:



cl : Befehlszeile error D8021 : Ungültiges numerisches Argument /Wl,-DLL,-IMPLIB:cxx-lib/.libs/cxxasn1.dll.lib.
make[1]: *** [Makefile:1641: cxx-lib/libcxxasn1.la] Error 2
make[1]: Leaving directory '/d/Projekte/esnacc-ng'
make: *** [Makefile:1370: all] Error 2
PS D:Projekteesnacc-ng>


Problem 2:
Trying to use the static library like this in my pri file:



LIBS += -L$$PWD/cxx-lib/libs/ -lcxxasn1
LIBS += -L$$PWD/cxx-lib/libs/ -lcxxasn1rose

INCLUDEPATH += $$PWD
INCLUDEPATH += $$PWD/cxx-lib/inc

HEADERS += $$PWD/MyAsnFile.h

SOURCES += $$PWD/MyAsnFile.cpp

QMAKE_CFLAGS_MT+=$$PWD/cxx-lib/inc
QMAKE_CXXFLAGS_MT+=$$PWD/cxx-lib/inc
#QMAKE_CFLAGS_RELEASE += /MD
DISTFILES +=
$$PWD/cxx-lib/inc/snacc.h.in


i get the Error during compilation:



Fehler: LNK2038: Konflikt ermittelt für "RuntimeLibrary": Der Wert "MT_StaticRelease" stimmt nicht mit dem Wert "MD_DynamicRelease" in main.obj überein.


I saw this thread here but am not sure on how to convert it into something useful for myself:
LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in file.obj










share|improve this question

























  • This answer says what needs to be done. So what is unclear?

    – Werner Henze
    Nov 14 '18 at 9:29








  • 3





    Possible duplicate of LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in file.obj

    – Werner Henze
    Nov 14 '18 at 9:30











  • Im not sure, i dont use any /mt /md arguments in either of the two. how do i even find out the status quo to see which one is compiled with which settings? how do i add the /mt or /md arguements when compiling esnacc?

    – momosxp
    Nov 14 '18 at 9:40











  • i tried adding CFLAGS=-MD or CXXFLAGS with the same result (with MT also)

    – momosxp
    Nov 14 '18 at 9:41


















0















im trying to compile essnac-ng library from github with msvc2017 to use in an already existing qt-Project.



I managed to compile it using msys2 (with make, autoconf, automake, yacc, bison) and powershell:



cmd.exe /k "C:Program Files (x86)Microsoft Visual Studio2017CommunityVCAuxiliaryBuildvcvarsall.bat" x86 `& powershell
cd D:Projekteesnacc-ng
bash ./boot.sh
bash ./configure LD=linker.exe
make
make install


Problem 1: it is only compiling the static libraries with the following warning during make:



warning: undefined symbols not allowed in x86_64-pc-msys shared libraries; building static only


after trying what this thread here says:
libtool: undefined symbols not allowed in i686-pc-mingw32 shared
i get an error during make:



cl : Befehlszeile error D8021 : Ungültiges numerisches Argument /Wl,-DLL,-IMPLIB:cxx-lib/.libs/cxxasn1.dll.lib.
make[1]: *** [Makefile:1641: cxx-lib/libcxxasn1.la] Error 2
make[1]: Leaving directory '/d/Projekte/esnacc-ng'
make: *** [Makefile:1370: all] Error 2
PS D:Projekteesnacc-ng>


Problem 2:
Trying to use the static library like this in my pri file:



LIBS += -L$$PWD/cxx-lib/libs/ -lcxxasn1
LIBS += -L$$PWD/cxx-lib/libs/ -lcxxasn1rose

INCLUDEPATH += $$PWD
INCLUDEPATH += $$PWD/cxx-lib/inc

HEADERS += $$PWD/MyAsnFile.h

SOURCES += $$PWD/MyAsnFile.cpp

QMAKE_CFLAGS_MT+=$$PWD/cxx-lib/inc
QMAKE_CXXFLAGS_MT+=$$PWD/cxx-lib/inc
#QMAKE_CFLAGS_RELEASE += /MD
DISTFILES +=
$$PWD/cxx-lib/inc/snacc.h.in


i get the Error during compilation:



Fehler: LNK2038: Konflikt ermittelt für "RuntimeLibrary": Der Wert "MT_StaticRelease" stimmt nicht mit dem Wert "MD_DynamicRelease" in main.obj überein.


I saw this thread here but am not sure on how to convert it into something useful for myself:
LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in file.obj










share|improve this question

























  • This answer says what needs to be done. So what is unclear?

    – Werner Henze
    Nov 14 '18 at 9:29








  • 3





    Possible duplicate of LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in file.obj

    – Werner Henze
    Nov 14 '18 at 9:30











  • Im not sure, i dont use any /mt /md arguments in either of the two. how do i even find out the status quo to see which one is compiled with which settings? how do i add the /mt or /md arguements when compiling esnacc?

    – momosxp
    Nov 14 '18 at 9:40











  • i tried adding CFLAGS=-MD or CXXFLAGS with the same result (with MT also)

    – momosxp
    Nov 14 '18 at 9:41
















0












0








0


0






im trying to compile essnac-ng library from github with msvc2017 to use in an already existing qt-Project.



I managed to compile it using msys2 (with make, autoconf, automake, yacc, bison) and powershell:



cmd.exe /k "C:Program Files (x86)Microsoft Visual Studio2017CommunityVCAuxiliaryBuildvcvarsall.bat" x86 `& powershell
cd D:Projekteesnacc-ng
bash ./boot.sh
bash ./configure LD=linker.exe
make
make install


Problem 1: it is only compiling the static libraries with the following warning during make:



warning: undefined symbols not allowed in x86_64-pc-msys shared libraries; building static only


after trying what this thread here says:
libtool: undefined symbols not allowed in i686-pc-mingw32 shared
i get an error during make:



cl : Befehlszeile error D8021 : Ungültiges numerisches Argument /Wl,-DLL,-IMPLIB:cxx-lib/.libs/cxxasn1.dll.lib.
make[1]: *** [Makefile:1641: cxx-lib/libcxxasn1.la] Error 2
make[1]: Leaving directory '/d/Projekte/esnacc-ng'
make: *** [Makefile:1370: all] Error 2
PS D:Projekteesnacc-ng>


Problem 2:
Trying to use the static library like this in my pri file:



LIBS += -L$$PWD/cxx-lib/libs/ -lcxxasn1
LIBS += -L$$PWD/cxx-lib/libs/ -lcxxasn1rose

INCLUDEPATH += $$PWD
INCLUDEPATH += $$PWD/cxx-lib/inc

HEADERS += $$PWD/MyAsnFile.h

SOURCES += $$PWD/MyAsnFile.cpp

QMAKE_CFLAGS_MT+=$$PWD/cxx-lib/inc
QMAKE_CXXFLAGS_MT+=$$PWD/cxx-lib/inc
#QMAKE_CFLAGS_RELEASE += /MD
DISTFILES +=
$$PWD/cxx-lib/inc/snacc.h.in


i get the Error during compilation:



Fehler: LNK2038: Konflikt ermittelt für "RuntimeLibrary": Der Wert "MT_StaticRelease" stimmt nicht mit dem Wert "MD_DynamicRelease" in main.obj überein.


I saw this thread here but am not sure on how to convert it into something useful for myself:
LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in file.obj










share|improve this question
















im trying to compile essnac-ng library from github with msvc2017 to use in an already existing qt-Project.



I managed to compile it using msys2 (with make, autoconf, automake, yacc, bison) and powershell:



cmd.exe /k "C:Program Files (x86)Microsoft Visual Studio2017CommunityVCAuxiliaryBuildvcvarsall.bat" x86 `& powershell
cd D:Projekteesnacc-ng
bash ./boot.sh
bash ./configure LD=linker.exe
make
make install


Problem 1: it is only compiling the static libraries with the following warning during make:



warning: undefined symbols not allowed in x86_64-pc-msys shared libraries; building static only


after trying what this thread here says:
libtool: undefined symbols not allowed in i686-pc-mingw32 shared
i get an error during make:



cl : Befehlszeile error D8021 : Ungültiges numerisches Argument /Wl,-DLL,-IMPLIB:cxx-lib/.libs/cxxasn1.dll.lib.
make[1]: *** [Makefile:1641: cxx-lib/libcxxasn1.la] Error 2
make[1]: Leaving directory '/d/Projekte/esnacc-ng'
make: *** [Makefile:1370: all] Error 2
PS D:Projekteesnacc-ng>


Problem 2:
Trying to use the static library like this in my pri file:



LIBS += -L$$PWD/cxx-lib/libs/ -lcxxasn1
LIBS += -L$$PWD/cxx-lib/libs/ -lcxxasn1rose

INCLUDEPATH += $$PWD
INCLUDEPATH += $$PWD/cxx-lib/inc

HEADERS += $$PWD/MyAsnFile.h

SOURCES += $$PWD/MyAsnFile.cpp

QMAKE_CFLAGS_MT+=$$PWD/cxx-lib/inc
QMAKE_CXXFLAGS_MT+=$$PWD/cxx-lib/inc
#QMAKE_CFLAGS_RELEASE += /MD
DISTFILES +=
$$PWD/cxx-lib/inc/snacc.h.in


i get the Error during compilation:



Fehler: LNK2038: Konflikt ermittelt für "RuntimeLibrary": Der Wert "MT_StaticRelease" stimmt nicht mit dem Wert "MD_DynamicRelease" in main.obj überein.


I saw this thread here but am not sure on how to convert it into something useful for myself:
LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in file.obj







c++ visual-studio qt compiler-errors linker






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 14 '18 at 11:06







momosxp

















asked Nov 14 '18 at 9:19









momosxpmomosxp

25318




25318













  • This answer says what needs to be done. So what is unclear?

    – Werner Henze
    Nov 14 '18 at 9:29








  • 3





    Possible duplicate of LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in file.obj

    – Werner Henze
    Nov 14 '18 at 9:30











  • Im not sure, i dont use any /mt /md arguments in either of the two. how do i even find out the status quo to see which one is compiled with which settings? how do i add the /mt or /md arguements when compiling esnacc?

    – momosxp
    Nov 14 '18 at 9:40











  • i tried adding CFLAGS=-MD or CXXFLAGS with the same result (with MT also)

    – momosxp
    Nov 14 '18 at 9:41





















  • This answer says what needs to be done. So what is unclear?

    – Werner Henze
    Nov 14 '18 at 9:29








  • 3





    Possible duplicate of LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in file.obj

    – Werner Henze
    Nov 14 '18 at 9:30











  • Im not sure, i dont use any /mt /md arguments in either of the two. how do i even find out the status quo to see which one is compiled with which settings? how do i add the /mt or /md arguements when compiling esnacc?

    – momosxp
    Nov 14 '18 at 9:40











  • i tried adding CFLAGS=-MD or CXXFLAGS with the same result (with MT also)

    – momosxp
    Nov 14 '18 at 9:41



















This answer says what needs to be done. So what is unclear?

– Werner Henze
Nov 14 '18 at 9:29







This answer says what needs to be done. So what is unclear?

– Werner Henze
Nov 14 '18 at 9:29






3




3





Possible duplicate of LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in file.obj

– Werner Henze
Nov 14 '18 at 9:30





Possible duplicate of LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in file.obj

– Werner Henze
Nov 14 '18 at 9:30













Im not sure, i dont use any /mt /md arguments in either of the two. how do i even find out the status quo to see which one is compiled with which settings? how do i add the /mt or /md arguements when compiling esnacc?

– momosxp
Nov 14 '18 at 9:40





Im not sure, i dont use any /mt /md arguments in either of the two. how do i even find out the status quo to see which one is compiled with which settings? how do i add the /mt or /md arguements when compiling esnacc?

– momosxp
Nov 14 '18 at 9:40













i tried adding CFLAGS=-MD or CXXFLAGS with the same result (with MT also)

– momosxp
Nov 14 '18 at 9:41







i tried adding CFLAGS=-MD or CXXFLAGS with the same result (with MT also)

– momosxp
Nov 14 '18 at 9:41














1 Answer
1






active

oldest

votes


















0














I managed to solve it like this:
i removed stdafx.h and stdafx.cpp from the source code of the project and removed the line where it was included (for esnacc it was the snacdll.cpp)



i compiled the static lib, configured like this:



bash ./configure LD=linker.exe CFLAGS=-MD CXXFLAGS=-MD --build=i686-pc-msys --host=i686-pc-msys


and added the libs cxxasn1.lib and cxxasn1rose.lib to my qtproject
however i would still get Linker errors: LNK2001 Errors



error lnk2001 unresolved external symbol __imp__closesocket


so i linked against the Ws2_32.lib library:



LIBS += -L$$PWD/cxx-lib/libs/ -lcxxasn1
LIBS += -L$$PWD/cxx-lib/libs/ -lcxxasn1rose
LIBS += -lws2_32
INCLUDEPATH += $$PWD
INCLUDEPATH += $$PWD/cxx-lib/inc

HEADERS += $$PWD/CoopIts.h

SOURCES += $$PWD/CoopIts.cpp

QMAKE_CFLAGS_MT+=$$PWD/cxx-lib/inc
QMAKE_CXXFLAGS_MT+=$$PWD/cxx-lib/inc





share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53296677%2flnk2038-mismatch-detected-for-runtimelibrary-value-mt-staticrelease-doesn%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    I managed to solve it like this:
    i removed stdafx.h and stdafx.cpp from the source code of the project and removed the line where it was included (for esnacc it was the snacdll.cpp)



    i compiled the static lib, configured like this:



    bash ./configure LD=linker.exe CFLAGS=-MD CXXFLAGS=-MD --build=i686-pc-msys --host=i686-pc-msys


    and added the libs cxxasn1.lib and cxxasn1rose.lib to my qtproject
    however i would still get Linker errors: LNK2001 Errors



    error lnk2001 unresolved external symbol __imp__closesocket


    so i linked against the Ws2_32.lib library:



    LIBS += -L$$PWD/cxx-lib/libs/ -lcxxasn1
    LIBS += -L$$PWD/cxx-lib/libs/ -lcxxasn1rose
    LIBS += -lws2_32
    INCLUDEPATH += $$PWD
    INCLUDEPATH += $$PWD/cxx-lib/inc

    HEADERS += $$PWD/CoopIts.h

    SOURCES += $$PWD/CoopIts.cpp

    QMAKE_CFLAGS_MT+=$$PWD/cxx-lib/inc
    QMAKE_CXXFLAGS_MT+=$$PWD/cxx-lib/inc





    share|improve this answer






























      0














      I managed to solve it like this:
      i removed stdafx.h and stdafx.cpp from the source code of the project and removed the line where it was included (for esnacc it was the snacdll.cpp)



      i compiled the static lib, configured like this:



      bash ./configure LD=linker.exe CFLAGS=-MD CXXFLAGS=-MD --build=i686-pc-msys --host=i686-pc-msys


      and added the libs cxxasn1.lib and cxxasn1rose.lib to my qtproject
      however i would still get Linker errors: LNK2001 Errors



      error lnk2001 unresolved external symbol __imp__closesocket


      so i linked against the Ws2_32.lib library:



      LIBS += -L$$PWD/cxx-lib/libs/ -lcxxasn1
      LIBS += -L$$PWD/cxx-lib/libs/ -lcxxasn1rose
      LIBS += -lws2_32
      INCLUDEPATH += $$PWD
      INCLUDEPATH += $$PWD/cxx-lib/inc

      HEADERS += $$PWD/CoopIts.h

      SOURCES += $$PWD/CoopIts.cpp

      QMAKE_CFLAGS_MT+=$$PWD/cxx-lib/inc
      QMAKE_CXXFLAGS_MT+=$$PWD/cxx-lib/inc





      share|improve this answer




























        0












        0








        0







        I managed to solve it like this:
        i removed stdafx.h and stdafx.cpp from the source code of the project and removed the line where it was included (for esnacc it was the snacdll.cpp)



        i compiled the static lib, configured like this:



        bash ./configure LD=linker.exe CFLAGS=-MD CXXFLAGS=-MD --build=i686-pc-msys --host=i686-pc-msys


        and added the libs cxxasn1.lib and cxxasn1rose.lib to my qtproject
        however i would still get Linker errors: LNK2001 Errors



        error lnk2001 unresolved external symbol __imp__closesocket


        so i linked against the Ws2_32.lib library:



        LIBS += -L$$PWD/cxx-lib/libs/ -lcxxasn1
        LIBS += -L$$PWD/cxx-lib/libs/ -lcxxasn1rose
        LIBS += -lws2_32
        INCLUDEPATH += $$PWD
        INCLUDEPATH += $$PWD/cxx-lib/inc

        HEADERS += $$PWD/CoopIts.h

        SOURCES += $$PWD/CoopIts.cpp

        QMAKE_CFLAGS_MT+=$$PWD/cxx-lib/inc
        QMAKE_CXXFLAGS_MT+=$$PWD/cxx-lib/inc





        share|improve this answer















        I managed to solve it like this:
        i removed stdafx.h and stdafx.cpp from the source code of the project and removed the line where it was included (for esnacc it was the snacdll.cpp)



        i compiled the static lib, configured like this:



        bash ./configure LD=linker.exe CFLAGS=-MD CXXFLAGS=-MD --build=i686-pc-msys --host=i686-pc-msys


        and added the libs cxxasn1.lib and cxxasn1rose.lib to my qtproject
        however i would still get Linker errors: LNK2001 Errors



        error lnk2001 unresolved external symbol __imp__closesocket


        so i linked against the Ws2_32.lib library:



        LIBS += -L$$PWD/cxx-lib/libs/ -lcxxasn1
        LIBS += -L$$PWD/cxx-lib/libs/ -lcxxasn1rose
        LIBS += -lws2_32
        INCLUDEPATH += $$PWD
        INCLUDEPATH += $$PWD/cxx-lib/inc

        HEADERS += $$PWD/CoopIts.h

        SOURCES += $$PWD/CoopIts.cpp

        QMAKE_CFLAGS_MT+=$$PWD/cxx-lib/inc
        QMAKE_CXXFLAGS_MT+=$$PWD/cxx-lib/inc






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 14 '18 at 11:59

























        answered Nov 14 '18 at 11:15









        momosxpmomosxp

        25318




        25318






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53296677%2flnk2038-mismatch-detected-for-runtimelibrary-value-mt-staticrelease-doesn%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Xamarin.iOS Cant Deploy on Iphone

            Glorious Revolution

            Dulmage-Mendelsohn matrix decomposition in Python