Windows includepath and libs



  • hello i'm under windows if in the .pro file i add this
    @
    LIBS += -lClasse_scarico_rev_01
    INCLUDEPATH += C:\librerie_luca\Classe_scarico_rev_01
    @

    i get c:/qt/2010.05/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: cannot find -lClasse_scarico_rev_01

    if i write this
    @
    LIBS += C:\librerie_luca\Classe_scarico_rev_01
    LIBS += -lClasse_scarico_rev_01
    @
    i get c:/qt/2010.05/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: C:\librerie_luca\Classe_scarico_rev_01: No such file: Permission denied

    What is wrong

    Thanks Luca

    Edit: one thing that's wrong is your use of @ tags for the code ;-) ; Andre



  • The includepath is aimed at where header files are found. Not where library files are found. That is documented in the qmake Variable Reference documentation.



  • The .h file of the lib that i need to use are in

    C:\librerie_luca\Classe_scarico_rev_01



  • @
    LIBS += -LC:\librerie_luca\Classe_scarico_rev_01
    @



  • Better not to use backslashes though. They will trigger a qmake warning :-)



  • @QT += core gui network webkit
    TARGET = Excalibur_rev_01
    TEMPLATE = app
    SOURCES += main.cpp\widget.cpp
    HEADERS += widget.h
    FORMS += widget.ui
    #LIBS += C:\librerie_luca\Classe_scarico_rev_01
    LIBS += -LC:\librerie_luca\Classe_scarico_rev_01
    INCLUDEPATH += C:\librerie_luca\Classe_scarico_rev_01@

    I get:
    @
    debug/widget.o:C:\Documents and Settings\Luca-XP\Desktop\progetti qt\Excalibur_rev_01\Excalibur_rev_01-build-desktop/../Excalibur_rev_01/widget.cpp:478: undefined reference to `_imp___ZN21Classe_scarico_rev_018connettoE12QHostAddress7QStringS1_iib'

    collect2: ld returned 1 exit status

    mingw32-make[1]: *** [debug\Excalibur_rev_01.exe] Error 1

    mingw32-make: *** [debug] Error 2

    The process "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" exited with code %2.
    Error while building project Excalibur_rev_01 (target: Desktop)
    When executing build step 'Make'
    @

    Edit: fixed use of @ tags: only one tag needed per code block; Andre



  • Did you try to re-run qmake and make clean and make to rebuild you project. Seems like the QNetwork lib is not in the link list.



  • yes but i get the same error

    Luca



  • did you remove this line?

    @LIBS += -lClasse_scarico_rev_01@

    if yes, your lib is not linked to your program!

    -L adds a library search path (like -I does for includes)
    -l adds a particular library to your exe

    (I misread the error message, actually there is not QtNetwork missing, but some of your own classes).



  • I never remove this but i get the same error:
    From the program i have access to all the member of the class but i can't compile, this is the -pro file:

    @QT += core gui network webkit

    TARGET = Excalibur_rev_01
    TEMPLATE = app

    SOURCES += main.cpp
    widget.cpp

    HEADERS += widget.h

    FORMS += widget.ui

    LIBS += -LC:\librerie_luca\Classe_scarico_rev_01 -lClasse_scarico_rev_01

    INCLUDEPATH += C:\librerie_luca\Classe_scarico_rev_01
    @

    and the error that i get is this:

    @
    Running build steps for project Excalibur_rev_01...
    Starting: "c:/qt/2010.05/qt/bin/qmake.exe" C:/Documents and Settings/Luca-XP/Desktop/progetti_qt/Excalibur_rev_01/Excalibur_rev_01/Excalibur_rev_01.pro -r -spec win32-g++
    WARNING: c:\Documents and Settings\Luca-XP\Desktop\progetti_qt\Excalibur_rev_01\Excalibur_rev_01\Excalibur_rev_01.pro:20: Unescaped backslashes are deprecated.

    WARNING: c:\Documents and Settings\Luca-XP\Desktop\progetti_qt\Excalibur_rev_01\Excalibur_rev_01\Excalibur_rev_01.pro:20: Unescaped backslashes are deprecated.

    WARNING: c:\Documents and Settings\Luca-XP\Desktop\progetti_qt\Excalibur_rev_01\Excalibur_rev_01\Excalibur_rev_01.pro:20: Unescaped backslashes are deprecated.

    The process "c:/qt/2010.05/qt/bin/qmake.exe" exited normally.
    @

    than:

    @
    Running build steps for project Excalibur_rev_01...
    Configuration unchanged, skipping qmake step.
    Starting: "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" -w
    mingw32-make: Entering directory `C:/Documents and Settings/Luca-XP/Desktop/progetti_qt/Excalibur_rev_01/Excalibur_rev_01-build-desktop'

    C:/Qt/2010.05/mingw/bin/mingw32-make -f Makefile.Debug

    mingw32-make[1]: Entering directory `C:/Documents and Settings/Luca-XP/Desktop/progetti_qt/Excalibur_rev_01/Excalibur_rev_01-build-desktop'

    c:\Qt\2010.05\qt\bin\uic.exe ..\Excalibur_rev_01\widget.ui -o ui_widget.h

    g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"c:\Qt\2010.05\qt\include\QtCore" -I"c:\Qt\2010.05\qt\include\QtNetwork" -I"c:\Qt\2010.05\qt\include\QtGui" -I"c:\Qt\2010.05\qt\include\QtWebKit" -I"c:\Qt\2010.05\qt\include" -I"c:\librerie_luca\Classe_scarico_rev_01" -I"c:\Qt\2010.05\qt\include\ActiveQt" -I"debug" -I"." -I"..\Excalibur_rev_01" -I"." -I"c:\Qt\2010.05\qt\mkspecs\win32-g++" -o debug\main.o ..\Excalibur_rev_01\main.cpp

    g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"c:\Qt\2010.05\qt\include\QtCore" -I"c:\Qt\2010.05\qt\include\QtNetwork" -I"c:\Qt\2010.05\qt\include\QtGui" -I"c:\Qt\2010.05\qt\include\QtWebKit" -I"c:\Qt\2010.05\qt\include" -I"c:\librerie_luca\Classe_scarico_rev_01" -I"c:\Qt\2010.05\qt\include\ActiveQt" -I"debug" -I"." -I"..\Excalibur_rev_01" -I"." -I"c:\Qt\2010.05\qt\mkspecs\win32-g++" -o debug\widget.o ..\Excalibur_rev_01\widget.cpp

    ..\Excalibur_rev_01\widget.cpp: In member function 'void Widget::leggo_socket()':

    ..\Excalibur_rev_01\widget.cpp:512: warning: unused variable 'vero'

    C:\Qt\2010.05\qt\bin\moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"c:\Qt\2010.05\qt\include\QtCore" -I"c:\Qt\2010.05\qt\include\QtNetwork" -I"c:\Qt\2010.05\qt\include\QtGui" -I"c:\Qt\2010.05\qt\include\QtWebKit" -I"c:\Qt\2010.05\qt\include" -I"c:\librerie_luca\Classe_scarico_rev_01" -I"c:\Qt\2010.05\qt\include\ActiveQt" -I"debug" -I"." -I"..\Excalibur_rev_01" -I"." -I"c:\Qt\2010.05\qt\mkspecs\win32-g++" -D__GNUC__ -DWIN32 ..\Excalibur_rev_01\widget.h -o debug\moc_widget.cpp

    g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"c:\Qt\2010.05\qt\include\QtCore" -I"c:\Qt\2010.05\qt\include\QtNetwork" -I"c:\Qt\2010.05\qt\include\QtGui" -I"c:\Qt\2010.05\qt\include\QtWebKit" -I"c:\Qt\2010.05\qt\include" -I"c:\librerie_luca\Classe_scarico_rev_01" -I"c:\Qt\2010.05\qt\include\ActiveQt" -I"debug" -I"." -I"..\Excalibur_rev_01" -I"." -I"c:\Qt\2010.05\qt\mkspecs\win32-g++" -o debug\moc_widget.o debug\moc_widget.cpp

    g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o debug\Excalibur_rev_01.exe debug/main.o debug/widget.o debug/moc_widget.o -L"c:\Qt\2010.05\qt\lib" -lmingw32 -lqtmaind -LC:\librerie_luca\Classe_scarico_rev_01 -lClasse_scarico_rev_01 -lQtWebKitd4 -lQtGuid4 -lQtNetworkd4 -lQtCored4

    mingw32-make[1]: Leaving directory `C:/Documents and Settings/Luca-XP/Desktop/progetti_qt/Excalibur_rev_01/Excalibur_rev_01-build-desktop'

    mingw32-make: Leaving directory `C:/Documents and Settings/Luca-XP/Desktop/progetti_qt/Excalibur_rev_01/Excalibur_rev_01-build-desktop'

    c:/qt/2010.05/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: cannot find -lClasse_scarico_rev_01

    collect2: ld returned 1 exit status

    mingw32-make[1]: *** [debug\Excalibur_rev_01.exe] Error 1

    mingw32-make: *** [debug] Error 2

    The process "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" exited with code %2.
    Error while building project Excalibur_rev_01 (target: Desktop)
    @

    When executing build step 'Make'



  • Just one idea, can you please post a dir listing of this folder:
    C:\librerie_luca\Classe_scarico_rev_01



  • Hello
    I have delete the lib an the program folder, remake all exact the same and now the program work.
    Many thanks for you help and time

    Luca


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.