Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. ㅠ0ㅠ help me plz..
Forum Updated to NodeBB v4.3 + New Features

ㅠ0ㅠ help me plz..

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 2.0k 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.
  • W Offline
    W Offline
    wow505
    wrote on last edited by
    #1

    hi~ guys

    i want to compile 'hello world' tutorial source..

    @
    #include <QApplication>

    #include <QPushButton>

    #include <QTranslator>

    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);
    QTranslator translator;

    translator.load("hellotr_la");
    
    app.installTranslator(&translator);
    
    QPushButton hello(QPushButton::tr("Hello world!"));
    
    hello.resize(100, 30);
    
    hello.show();
    
    return app.exec&#40;&#41;;
    

    }
    @

    but... linking fail..

    Would you tell me what's the problem? plz..

    17:16:27 **** Incremental Build of configuration Debug for project test ****
    make all
    'Building target: test.exe'
    'Invoking: MinGW C++ Linker'
    g++ -L"C:\Qt\4.8.4\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4 -mthreads -Wl,-subsystem,windows -o "test.exe" ./test.o
    ./test.o: In function main': C:\Project\test\Debug/../test.cpp:6: multiple definition of main'
    c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../libmingw32.a(main.o):C:\MinGW\msys\1.0\src\mingwrt/../mingw/main.c:24: first defined here
    C:\Qt\4.8.4\lib/libqtmaind.a(qtmain_win.o): In function WinMain@16': c:\iwmake\build_mingw_opensource\src\winmain/qtmain_win.cpp:131: undefined reference to qMain(int, char**)'
    ./test.o:test.cpp:(.text+0x33): undefined reference to _imp___ZN12QApplicationC1ERiPPci' ./test.o:test.cpp:(.text+0x48): undefined reference to _imp___ZN11QTranslatorC1EP7QObject'
    ./test.o:test.cpp:(.text+0xa5): undefined reference to _imp___ZN11QTranslator4loadERK7QStringS2_S2_S2_' ./test.o:test.cpp:(.text+0xde): undefined reference to _imp___ZN16QCoreApplication17installTranslatorEP11QTranslator'
    ./test.o:test.cpp:(.text+0x118): undefined reference to _imp___ZN11QPushButtonC1ERK7QStringP7QWidget' ./test.o:test.cpp:(.text+0x150): undefined reference to _imp___ZN12QApplication4execEv'
    ./test.o:test.cpp:(.text+0x15f): undefined reference to _imp___ZN11QPushButtonD1Ev' ./test.o:test.cpp:(.text+0x16c): undefined reference to _imp___ZN11QTranslatorD1Ev'
    ./test.o:test.cpp:(.text+0x179): undefined reference to _imp___ZN12QApplicationD1Ev' ./test.o:test.cpp:(.text+0x1df): undefined reference to _imp___ZN11QPushButtonD1Ev'
    ./test.o:test.cpp:(.text+0x1f0): undefined reference to _imp___ZN11QTranslatorD1Ev' ./test.o:test.cpp:(.text+0x201): undefined reference to _imp___ZN12QApplicationD1Ev'
    ./test.o:test.cpp:(.text$_ZN7QStringC1EPKc[QString::QString(char const*)]+0x15): undefined reference to _imp___ZN7QString16fromAscii_helperEPKci' ./test.o:test.cpp:(.text$_ZN7QStringC1Ev[QString::QString()]+0xb): undefined reference to _imp___ZN7QString11shared_nullE'
    ./test.o:test.cpp:(.text$_ZN7QWidget6resizeEii[QWidget::resize(int, int)]+0x2d): undefined reference to _imp___ZN7QWidget6resizeERK5QSize' ./test.o:test.cpp:(.text$_ZN11QPushButton2trEPKcS1_[QPushButton::tr(char const*, char const*)]+0x19): undefined reference to _imp___ZN11QPushButton16staticMetaObjectE'
    ./test.o:test.cpp:(.text$ZN11QPushButton2trEPKcS1[QPushButton::tr(char const*, char const*)]+0x25): undefined reference to `imp___ZNK11QMetaObject2trEPKcS1'
    collect2: ld returned 1 exit status
    make: *** [test.exe] Error 1

    17:16:27 Build Finished (took 320ms)

    [[Added markups for code, Tobias]]

    1 Reply Last reply
    0
    • shavS Offline
      shavS Offline
      shav
      wrote on last edited by
      #2

      Hi,

      Did you try add to *.pro file module with name "widgets" something like this:
      @
      QT += widgets
      @

      Mac OS and iOS Developer

      1 Reply Last reply
      0
      • sierdzioS Offline
        sierdzioS Offline
        sierdzio
        Moderators
        wrote on last edited by
        #3

        [quote author="shav" date="1358608747"]Hi,

        Did you try add to *.pro file module with name "widgets" something like this:
        @
        QT += widgets
        @[/quote]

        He is using Qt 4, there is no module called "widgets" there.

        wow505 please attach your .pro file, too.

        (Z(:^

        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