Results 1 to 7 of 7

Thread: QtCreator and external libraries

  1. #1
    Join Date
    Feb 2009
    Location
    Italy
    Posts
    15
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QtCreator and external libraries

    Hi,

    I've developed a test application that makes use of psapi but when
    I try to compile it, I obtain linking error like this

    prova2.cpp:66: undefined reference to `EnumProcesses@12'
    So emerged the necessity to add libpsapi.a how can be done this in Qt Creator,
    if i need to do this manually what I've to do?

    Thanks,
    Giuseppe Bonfa'
    Happiness depends on being self-sufficient, and a master of mental attitude, self-sufficiency is achieved by living a life of Virtue - Cynics

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QtCreator and external libraries

    Open the .pro file and add LIBS += libpsapi.a and rerun qmake.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    GiuseppeBonfa (21st February 2009)

  4. #3
    Join Date
    Feb 2009
    Location
    Italy
    Posts
    15
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QtCreator and external libraries

    Thanks, solved by changing makefile in that way

    Qt Code:
    1. LIBS = -L"c:\Qt\QtCreator\qt\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4 [B]-lpsapi[/B]
    To copy to clipboard, switch view to plain text mode 

    now the problem is that i need to convert a TCHAR into QString

    Qt Code:
    1. TCHAR szProcessName[4096] = {0};
    2. //other code
    3. QString aaa = QString::fromUtf16((ushort*)szProcessName);
    To copy to clipboard, switch view to plain text mode 

    but aaa comes out empty!
    Happiness depends on being self-sufficient, and a master of mental attitude, self-sufficiency is achieved by living a life of Virtue - Cynics

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QtCreator and external libraries

    Is it encoded in UTF-16?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #5
    Join Date
    Feb 2009
    Location
    Italy
    Posts
    15
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QtCreator and external libraries

    Solved in this way

    Qt Code:
    1. #ifdef Q_OS_WIN
    2. #ifdef UNICODE
    3. aaa = QString::fromUtf16((ushort*)szProcessName);
    4. #else
    5. aaa = QString::fromLocal8Bit(szProcessName);
    6. #endif
    7. #endif
    To copy to clipboard, switch view to plain text mode 
    Happiness depends on being self-sufficient, and a master of mental attitude, self-sufficiency is achieved by living a life of Virtue - Cynics

  7. #6
    Join Date
    May 2012
    Posts
    2
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: QtCreator and external libraries

    how can i change the LIBS things in make file?

  8. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QtCreator and external libraries

    You can't. You should modify the .pro file.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.