Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Linker error with testlib project
QtWS25 Last Chance

Linker error with testlib project

Scheduled Pinned Locked Moved Qt Creator and other tools
2 Posts 1 Posters 3.6k Views
  • 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.
  • S Offline
    S Offline
    sptrakesh
    wrote on last edited by
    #1

    Hello,

    I have been using Qt Creator as a Qt and general purpose IDE for the past few weeks. My desktop and Wt applications are running fine. I am now in the process of creating a core library project with associated unit test suite (my first attempt at using the testlib framework). I created the project based upon http://qtcreator.blogspot.com/2010/04/sample-multiple-unit-test-project.html.

    @
    QT += testlib
    QT -= gui

    CONFIG += console
    CONFIG -= app_bundle

    TARGET = UnitTest
    TEMPLATE = app

    INCLUDEPATH +=
    /opt/local/include
    /opt/local/include/mongo
    src test

    LIBS +=
    -lssl -lcrypto

    SOURCES +=
    src/util/Encrypter.cpp
    test/main.cpp
    test/util/EncrypterTestSuite.cpp

    HEADERS +=
    src/util/Encrypter.h
    test/AutoTest.h
    test/util/EncrypterTestSuite.h
    @

    The code builds fine, however linking fails with the following error:

    @g++ -headerpad_max_install_names -o UnitTest Encrypter.o main.o EncrypterTestSuite.o moc_EncrypterTestSuite.o -F/Library/Frameworks -L/Library/Frameworks -lssl -lcrypto -framework QtTest -L/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/lib -F/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/lib -framework IOKit -framework ApplicationServices -framework Security -framework QtCore
    ld: warning: directory not found for option '-L/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/lib'
    ld: warning: directory not found for option '-F/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/lib'
    Undefined symbols for architecture x86_64:
    "EncrypterTestSuite::initTestCase()", referenced from:
    EncrypterTestSuite::qt_metacall(QMetaObject::Call, int, void**)in moc_EncrypterTestSuite.o
    "EncrypterTestSuite::testAes()", referenced from:
    EncrypterTestSuite::qt_metacall(QMetaObject::Call, int, void**)in moc_EncrypterTestSuite.o
    "EncrypterTestSuite::testDes()", referenced from:
    EncrypterTestSuite::qt_metacall(QMetaObject::Call, int, void**)in moc_EncrypterTestSuite.o
    "EncrypterTestSuite::cleanupTestCase()", referenced from:
    EncrypterTestSuite::qt_metacall(QMetaObject::Call, int, void**)in moc_EncrypterTestSuite.o
    ld: symbol(s) not found for architecture x86_64
    collect2: ld returned 1 exit status
    make: *** [UnitTest] Error 1
    make: Leaving directory `/Users/rakesh/svn/cpp/coretest-build-desktop'
    The process "/usr/bin/make" exited with code %2.
    Error while building project coretest (target: Desktop)
    When executing build step 'Make'@

    The build directory contains all the .o files, so I am not sure what is wrong. Just running the test project downloaded from above mentioned link does work fine. Any idea what I might be missing in my project configuration?

    Thanks in advance for all help.
    Rakesh

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sptrakesh
      wrote on last edited by
      #2

      Never mind, classic case of me spotting the problem a few seconds after posting the issue. Auto complete seems to have messed up the class name in the test class implementation file. Sorry for wasting bandwidth.

      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