PDA

View Full Version : Qt Creator error: /NODEFAULTLIB:library: No such file or directory



hasanbaghal
2nd December 2017, 19:10
In Qt Creator ,Application.pro I have these lines of code:
...
#------------------------------------------------------------------------------
# Compiler flags:
#------------------------------------------------------------------------------



CONFIG += warn_off

QMAKE_LFLAGS += -Wl,-rpath,$$(VTKHOME)/lib/vtk-5.2

win32 {
QMAKE_LFLAGS += /NODEFAULTLIB:library
}

QMAKE_CXXFLAGS_DEBUG += -g
QMAKE_CXXFLAGS += -g

...


when I run the project I got this error:
error: /NODEFAULTLIB:library: No such file or directory


Its maybe related to qt creator environment settings ,or program codes.

As I changed This
CONFIG += warn_off


to
CONFIG += static


there is no error but a window opens and want to specify an executable File, and at last Run * and below is the message

No executable specified.

I have these files in my release folder:
AppGUI_res.o
libApp.a
libtest.a


so what should I do to Execute my program ,It Built with no errors.

ChrisW67
11th December 2017, 21:38
I looks like you are using MingW to compile the application (from the file extensions) but the application.pro has been written on the assumption you are using the Microsoft compiler toolchain. The MingW linker will get "/NODEFAULTLIB:library" as an argument and try to treat it as a file name giving the error message you posted.

d_stranz
12th December 2017, 14:55
"/NODEFAULTLIB:library"

I am not even sure this is correct syntax for MSVC - I think "library" must be replaced with the actual name of the library to exclude. See MSDN here. (https://msdn.microsoft.com/en-us/library/3tz4da4a.aspx)