Important: Please read the Qt Code of Conduct -

Error in compilation of a library

  • Hello,
    I am having problems when trying to compile a library that is supposed to work with Visual Studio.
    I get this error:
    #error Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]
    from the afx.h file.

    There are a lot of soltion on the internet, but all are assuming that one is using VS to handle the project. I am using Qt creator with Qt 5.9.1 .
    Is there a way around to solve this issue?

    Please let me know if the problem is not clear or more details are needed.

  • Moderators

    well it says to define _AFXDLL. This can be easily done in your .pro file by adding DEFINES += _AFXDLL

    Alternatively most VS project settings result in a simple call parameter on the compiler. The same compiler is used by QtCreator. So you can also set compiler parameters by adding QMAKE_CXXFLAGS += -O1 for example.

Log in to reply