Results 1 to 5 of 5

Thread: Adding an existing library to a project.

  1. #1

    Default Adding an existing library to a project.

    Hello everyone.

    I am trying to create a project assosiated wtih the SimConnect SDK.

    I am new to QT, and in Visual Studio, i just had a SimConnect.h file, a .lib file, and a .dll file, and i managed to make it work.
    Now I am trying to create a c++ widget project, using the same SDK, but in QT.

    I put the header file in my QT project's folder, where the other default code and header files are located, and then I went to the project and added them as existing files, as I read in google.
    Im having problems with the actual library.

    I've been searching Google all day long for a guide on how to add a library file to the project, I did some things i saw on the internet, like the LIBS line for example, but I probably did it wrong, even though it looked very simple.
    I am not sure where to drop my dll/library files in the project directory, maybe the problem is I always put them in the wrong spot.
    The closest I got to, was an error message saying "Unresolved external symbol" on every function i tried to use from the SimConnect functions, which probably means QT couldnt find my library/dll file.

    I also tried to add the libraries from the "Add library" option in the project, but that didnt work too.

    Usualy I would add some code to the thread, but there actualy is no real code to add.

    I will open a new widget project, and will follow anything you guys say
    Thanks!

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

    Default Re: Adding an existing library to a project.

    Assuming you are using qmake to build your project, you need to add a LIBS directive to tell the compiler to link against your library. If the library is placed in a directory not usually looked into by the linker, you need to inform the compiler about that location (by adding a -L<directory> entry to LIBS).
    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. #3

    Default Re: Adding an existing library to a project.

    Quote Originally Posted by wysota View Post
    Assuming you are using qmake to build your project, you need to add a LIBS directive to tell the compiler to link against your library. If the library is placed in a directory not usually looked into by the linker, you need to inform the compiler about that location (by adding a -L<directory> entry to LIBS).
    I think I tried that already, in the .pro page I wrote
    LIBS += -L(path to lib file's directory) -llibname
    It still writes "unresolved external....."
    I guess its something small im missing, hopefully.
    Thanks for the reply

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,971
    Thanks
    277
    Thanked 808 Times in 797 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: Adding an existing library to a project.

    (path to lib file's directory)
    Does this path have spaces in it? If so, you probably need to put it in quotes. What is the actual name of the library?
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

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

    Default Re: Adding an existing library to a project.

    What is the actual error you are getting? Did you verify the library exports that missing symbol?
    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.


Similar Threads

  1. Replies: 1
    Last Post: 3rd August 2016, 07:21
  2. Adding external library into Qt-Android project
    By Farrell in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 14th August 2015, 21:53
  3. Replies: 22
    Last Post: 1st February 2012, 21:56
  4. Adding library in another project
    By Anshuman in forum Qt Programming
    Replies: 1
    Last Post: 26th April 2011, 16:13
  5. adding dll to existing project...
    By aj2903 in forum Qt Programming
    Replies: 1
    Last Post: 1st December 2009, 09:35

Tags for this Thread

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.