Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. [solved] Linking QtCore on Fedora Linux
Forum Updated to NodeBB v4.3 + New Features

[solved] Linking QtCore on Fedora Linux

Scheduled Pinned Locked Moved Installation and Deployment
5 Posts 2 Posters 4.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    Ian Kaplan
    wrote on last edited by
    #1

    I am running Fedora Linux 14. After being completely horrified by the Boost thread package, I have been trying to get a simple program using the QtCore classes to link.

    The program I'm trying to build is:

    #include <iostream>
    #include <QtCore/QCoreApplication>

    using namespace std;

    int main(int argc, char *argv[]) {
    QCoreApplication app(argc, argv);
    cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!

    return 0;
    }

    I am building under Eclipse, using gcc 4.5.1

    I am getting lots of undefined references. I used:

    -L/opt/Qt/5.1.1/gcc_64/lib and -lQt5Core

    I am getting the following link errors:

    Invoking: GCC C++ Linker
    g++ -L/opt/Qt/5.1.1/gcc_64/lib -o "MatchingEngine" ./src/MatchingEngine.o ./src/TransactionRouter.o ./src/TransactionRouter_test.o -lQt5Core
    /usr/bin/ld: warning: libicui18n.so.51, needed by /opt/Qt/5.1.1/gcc_64/lib/libQt5Core.so, not found (try using -rpath or -rpath-link)
    /usr/bin/ld: warning: libicuuc.so.51, needed by /opt/Qt/5.1.1/gcc_64/lib/libQt5Core.so, not found (try using -rpath or -rpath-link)
    /opt/Qt/5.1.1/gcc_64/lib/libQt5Core.so: undefined reference to ucnv_getStandardName_51' /opt/Qt/5.1.1/gcc_64/lib/libQt5Core.so: undefined reference to ucol_close_51'
    /opt/Qt/5.1.1/gcc_64/lib/libQt5Core.so: undefined reference to `ucol_strcoll_51'
    [etc...]

    Any suggestions or pointers would be greatly appreciated. I'm searched for the libraries that should be included using QtCore, but I have not found anything. This is frustrating, since Qt is a great library. It puts Boost to shame. Well, it would if I could get it to build.

    I am hoping that someone can provide the set of link flags that I need to build on Linux.

    Many thanks in advance,

    Ian

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      You are not linking icu. If you want to know all dependencies, you should use qmake to generate the Makefiles for your project and read them. I would suggest you to use Qt Creator, it would be simpler to develop you C++ application

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • I Offline
        I Offline
        Ian Kaplan
        wrote on last edited by
        #3

        Thank you so much for the reply, Samuel.

        I agree that it would probably be better to use QtCreator, but I've gone done the Eclipse path a ways.

        I have Qt 5.1.1 installed. In Eclipse I added

        libicudata.so.51.1
        libicui18n.so.51.1
        libicuuc.so.51.1

        to the C/C++ Build under the project settings in the Miscellaneous section under C++ Linker. This took care of my undefined symbols.

        Under the Eclipse Run Configurations I added the LD_LIBRARY_PATH variable:

        LD_LIBRARY_PATH /opt/Qt/5.1.1/gcc_64/lib:$LD_LIBRARY_PATH

        I selected "Replace native environment with specified environment"

        This allowed the shared library to be found at run time.

        So it all worked. Well, so far. I have not tried the threaded code yet. But I got "Hello world". And what could go wrong? :-)

        Again, many thanks for your post and your time. This really got me past a road block. I was starting to look at Intel's Threaded Building Block library since I couldn't get Qt to work.

        Best,

        Ian

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You're welcome !

          For the threading part you should not have more dependencies. When using other module of Qt (gui, network, etc..) you should ldd the corresponding libraries and you'll see what you need. One package that you will probably need if it's not already installed is the OpenGL dev package (a frequent question on this forum)

          Since you got it working don't forget to update the thread title prepending [solved] so other forum users may know a solution has been found :)

          Happy coding !

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • I Offline
            I Offline
            Ian Kaplan
            wrote on last edited by
            #5

            Thanks for the pointer on the title, Samuel. And for the additional post.

            Best,
            Ian

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved