Reputation: 2442
I imported my Qt application developed on linux to windows. Now when I build my project I am getting this error:
error: LNK1146: no argument specified with option '/LIBPATH:'
I created a new project on windows and it works perfectly fine. One of the possible reason that would cause this is having spaces in the project path,but there are no spaces in my project path.Could you let me know how I could resolve this issue.
This is my .pro file:
#-------------------------------------------------
#
# Project created by QtCreator 2014-12-08T09:19:31
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = FirstProject
TEMPLATE = app
QMAKE_CXXFLAGS += -std=c++11
SOURCES += main.cpp\
firstscreen.cpp \
secondscreen.cpp \
thirdscreen.cpp
INCLUDEPATH += C:\Users\user_name\tango\ \
C:\Users\user_name\omniORB4\ \
C:\Users\user_name\omnithread.h
HEADERS += firstscreen.h \
C:\Users\user_name\tango\ \
C:\Users\user_name\omniORB4\ \
C:\Users\user_name\omnithread.h \
secondscreen.h \
thirdscreen.h
LIBS += -L -lomnithread \
-L -lomniORB4 \
-L -ltango
FORMS += firstscreen.ui \
secondscreen.ui \
thirdscreen.ui
Upvotes: 0
Views: 7081
Reputation: 93410
The problem happens because the flag -L
was specified, but no library paths were given:
LIBS += -L -lomnithread \
-L -lomniORB4 \
-L -ltango
To fix this problem, you must provide the paths where the .lib files are located, which would be something like:
LIBS += -L"C:\\Users\\user_name\\omnithread\\lib" -lomnithread \
-L"C:\\Users\\user_name\\omniORB4\\lib" -lomniORB4 \
-L"C:\\Users\\user_name\\tango\\lib" -ltango
Remember: there must be no empty spaces between -L
and the path string.
So doing it like this will also throw the same error:
LIBS += -L "C:\\Users\\user_name\\omnithread\\lib" -lomnithread \
-L "C:\\Users\\user_name\\omniORB4\\lib" -lomniORB4 \
-L "C:\\Users\\user_name\\tango\\lib" -ltango
Upvotes: 3
Reputation: 1245
In your .pro file the problem is probably the empty "-L" when assigning to LIBS. You need to write there the path for the following library specified "-l".
I fixed a less obvious situation like this:
Since the problem was hidden in the response file used by JOM I started JOM manually as executed by qmake. Simply copy the JOM call and execute it with an additional -U parameter to see the content of the response file:
C:\Qt\Tools\QtCreator\bin\jom.exe -U -f Makefile.Debug > x.txt
(of course you have to call it in the directory mentioned in the qmake output)
Next I checked all /LIBPATH: occurrences in x.txt. So it was easy to find the culprit and fix the .pro file.
Upvotes: 1
Reputation: 1653
In the current .pro file you specified library names, but didn't specify paths for your external libs. Those '-l' and '-L' keys are used exactly for this.
Some advice:
Upvotes: 0