5

QT gives the errors

LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library

where do I put the /NODEFAULTLIB:library ?

rreeves
  • 2,338
  • 4
  • 33
  • 50
  • possible duplicate of [Resolving LNK4098: defaultlib 'MSVCRT' conflicts with](http://stackoverflow.com/questions/3007312/resolving-lnk4098-defaultlib-msvcrt-conflicts-with) – Mgetz Jun 28 '13 at 18:39
  • @Mgetz Where do i put /NODEFAULTLIB:library ? – rreeves Jun 28 '13 at 18:47
  • there is an ignore default libraries setting under the linker settings – Mgetz Jun 28 '13 at 18:47
  • @Mgetz I cannot find any linker settings in Qt Creator 2.6.2 – rreeves Jun 28 '13 at 18:58
  • Ah... I can't help you there I can only speak to visual studio – Mgetz Jun 28 '13 at 19:00
  • 1
    This might be covered in the [Qt FAQs](http://qt-project.org/faq/answer/msvcrtd.libcinitexe.obj_warning_lnk4098_defaultlib_msvcrt.lib_conflicts_wit). But if you [need to add compiler options](http://stackoverflow.com/questions/6614049/adding-extra-compiler-option-in-qt), here's how – Huy Jun 28 '13 at 19:15
  • 1
    You didn't spell the library name correctly, fyi – Huy Jun 28 '13 at 20:58

3 Answers3

4

Some one with your very issue posted something on the Qt forums a while back.

Which sounds like passing in one of the additional options should help.

So in your .pro file:

// This
QMAKE_CXXFLAGS += /MD

// Or that
QMAKE_CXXFLAGS += /MT

And don't forget to run qmake to make sure the makefile arguments absorb the changes made to the .pro file.

Huy
  • 1,849
  • 18
  • 18
4

As far as I can tell this is a undocumented feature, but this is where you put it in QT Creator 2.6.2 w/ QT 4.8.4 (in the .pro file)

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../LIBRARYNAME/Lib/ -lLIBRARY /NODEFAULTLIB:library
rreeves
  • 2,338
  • 4
  • 33
  • 50
  • 1
    it's not an undocumented feature as much as it is simply a "less obvious way" of passing additional arguments to the compiler/makefile -- but congrats anyway! – Huy Jun 28 '13 at 23:03
1

This is how I did it under Qt5:

QMAKE_LFLAGS += /NODEFAULTLIB:LIBCMT
Sergey Skoblikov
  • 5,566
  • 6
  • 37
  • 48