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. Copied some example code but getting an error ~~~ Please help
Forum Updated to NodeBB v4.3 + New Features

Copied some example code but getting an error ~~~ Please help

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 3.5k 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.
  • A Offline
    A Offline
    amir734jj
    wrote on last edited by
    #1

    First of all , I am new in qt and coming from Java

    I want to run and compile some qt code so I can learn it , then I went to this website and saw they provided some qt examples

    "http://www.trinitydesktop.org/docs/qt4/widgets-analogclock.html":http://www.trinitydesktop.org/docs/qt4/widgets-analogclock.html

    I use the latest version of the qt and I copied the code but I get some error please help !

    http://s11.postimg.org/7w4rsg3v7/Scrshot1.png
    http://s11.postimg.org/p854dvxcj/Scrshot2.png
    http://s11.postimg.org/9ubfqfwcz/Scrshot3.png
    http://s11.postimg.org/vs7wk8bdf/Scrshot4.png
    http://s11.postimg.org/e4q3m11g3/Scrshot5.png

    or

    https://www.dropbox.com/sh/i2kze8hgbyp0s6t/RphTWF19NW

    Errors:

    @mainwindow.obj:-1: error: LNK2005: main already defined in main.obj
    debug\uwm.exe:-1: error: LNK1169: one or more multiply defined symbols found@

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      You have main program routines as the error message suggests. There is only one allowed in C++. Either eliminate main.cpp or mainwindow.cpp from your project.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • A Offline
        A Offline
        amir734jj
        wrote on last edited by
        #3

        Thanks Man, I went to the directory of project and deleted mainwindow.cpp and mainwindow.h
        and now errors are gone
        But after I build it it didn't run the program
        Please help !!!

        http://s22.postimg.org/iqosatggx/Scrshot6.png
        http://s22.postimg.org/d3sfdcdy9/Scrshot7.png
        http://s22.postimg.org/m2ihqdiu9/Scrshot8.png
        http://s22.postimg.org/4iz3m63s1/Scrshot9.png

        and I get this error

        http://s21.postimg.org/6z7t2mnx3/Scrshot11.png

        @11:58:21: Running steps for project uwm...
        11:58:21: Configuration unchanged, skipping qmake step.
        11:58:21: Starting: "C:\Qt\Qt5.0.2\Tools\QtCreator\bin\jom.exe"
        C:\Qt\Qt5.0.2\Tools\QtCreator\bin\jom.exe -f Makefile.Debug
        Error: dependent '..\uwm\mainwindow.cpp' does not exist.
        jom: D:\qt\build-uwm-Desktop_Qt_5_0_2_MSVC2012_64bit-Debug\Makefile [debug] Error 2
        11:58:21: The process "C:\Qt\Qt5.0.2\Tools\QtCreator\bin\jom.exe" exited with code 2.
        Error while building/deploying project uwm (kit: Desktop Qt 5.0.2 MSVC2012 64bit)
        When executing step 'Make'
        11:58:21: Elapsed time: 00:00.@

        1 Reply Last reply
        0
        • K Offline
          K Offline
          koahnig
          wrote on last edited by
          #4

          go to the project in your case "uwm" with the mouse and press right mouse button. Select "Run qmake" and rebuild afterwards.
          [quote author="amir734jj" date="1367080713"]
          @
          Error: dependent '..\uwm\mainwindow.cpp' does not exist.
          @[/quote]

          This line tells you that the file, which you have eliminated, is missing. Which is certainly, but it is still in your setup. Since the .pro file looks correct, Qt creator has not redone the makefiles, which you do manually with the sequence above.

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          0
          • A Offline
            A Offline
            amir734jj
            wrote on last edited by
            #5

            SOLVED ... Thanks

            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