Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Qt app compile error.
Forum Update on Monday, May 27th 2025

Qt app compile error.

Scheduled Pinned Locked Moved Solved 3rd Party Software
9 Posts 2 Posters 4.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.
  • D Offline
    D Offline
    dragostej
    wrote on 29 Oct 2015, 22:21 last edited by
    #1

    Hi
    Im a starter in Qt. Im use a third party library(TobiiGazeSdk) in my Qt app, and i get compile error, but dont know what is the problem. I need some help. Thank a lot.
    This is the output error:

    mainwindow.obj : error LNK2005: "void * __cdecl xthread_create(void *,void *)" (?xthread_create@@YAPAXPAX0@Z) already defined in main.obj
    mainwindow.obj : error LNK2005: "void __cdecl xthread_join(void *)" (?xthread_join@@YAXPAX@Z) already defined in main.obj
    mainwindow.obj : error LNK2005: "void __cdecl xinitialize_cv(struct xcondition_variable *)" (?xinitialize_cv@@YAXPAUxcondition_variable@@@Z) already defined in main.obj
    mainwindow.obj : error LNK2005: "int __cdecl xwait_until_ready(struct xcondition_variable *)" (?xwait_until_ready@@YAHPAUxcondition_variable@@@Z) already defined in main.obj
    mainwindow.obj : error LNK2005: "void __cdecl xsignal_ready(struct xcondition_variable *)" (?xsignal_ready@@YAXPAUxcondition_variable@@@Z) already defined in main.obj
    mainwindow.obj : error LNK2005: "void __cdecl report_and_exit_on_error(enum tobiigaze_error_code,char const *)" (?report_and_exit_on_error@@YAXW4tobiigaze_error_code@@PBD@Z) already defined in main.obj
    tobii.obj : error LNK2005: "void * __cdecl xthread_create(void *,void *)" (?xthread_create@@YAPAXPAX0@Z) already defined in main.obj
    tobii.obj : error LNK2005: "void __cdecl xthread_join(void *)" (?xthread_join@@YAXPAX@Z) already defined in main.obj
    tobii.obj : error LNK2005: "void __cdecl xinitialize_cv(struct xcondition_variable *)" (?xinitialize_cv@@YAXPAUxcondition_variable@@@Z) already defined in main.obj
    tobii.obj : error LNK2005: "int __cdecl xwait_until_ready(struct xcondition_variable *)" (?xwait_until_ready@@YAHPAUxcondition_variable@@@Z) already defined in main.obj
    tobii.obj : error LNK2005: "void __cdecl xsignal_ready(struct xcondition_variable *)" (?xsignal_ready@@YAXPAUxcondition_variable@@@Z) already defined in main.obj
    tobii.obj : error LNK2005: "void __cdecl report_and_exit_on_error(enum tobiigaze_error_code,char const *)" (?report_and_exit_on_error@@YAXW4tobiigaze_error_code@@PBD@Z) already defined in main.obj
    moc_mainwindow.obj : error LNK2005: "void * __cdecl xthread_create(void *,void *)" (?xthread_create@@YAPAXPAX0@Z) already defined in main.obj
    moc_mainwindow.obj : error LNK2005: "void __cdecl xthread_join(void *)" (?xthread_join@@YAXPAX@Z) already defined in main.obj
    moc_mainwindow.obj : error LNK2005: "void __cdecl xinitialize_cv(struct xcondition_variable *)" (?xinitialize_cv@@YAXPAUxcondition_variable@@@Z) already defined in main.obj
    moc_mainwindow.obj : error LNK2005: "int __cdecl xwait_until_ready(struct xcondition_variable *)" (?xwait_until_ready@@YAHPAUxcondition_variable@@@Z) already defined in main.obj
    moc_mainwindow.obj : error LNK2005: "void __cdecl xsignal_ready(struct xcondition_variable *)" (?xsignal_ready@@YAXPAUxcondition_variable@@@Z) already defined in main.obj
    moc_mainwindow.obj : error LNK2005: "void __cdecl report_and_exit_on_error(enum tobiigaze_error_code,char const *)" (?report_and_exit_on_error@@YAXW4tobiigaze_error_code@@PBD@Z) already defined in main.obj

    1 Reply Last reply
    0
    • H Offline
      H Offline
      hskoglund
      wrote on 29 Oct 2015, 22:53 last edited by
      #2

      Hi, I think you're including the Tobii SDK file Common.h in every .cpp file in your project, that's why you get the errors. Try including it in only one .cpp file.

      D 1 Reply Last reply 30 Oct 2015, 08:08
      0
      • H hskoglund
        29 Oct 2015, 22:53

        Hi, I think you're including the Tobii SDK file Common.h in every .cpp file in your project, that's why you get the errors. Try including it in only one .cpp file.

        D Offline
        D Offline
        dragostej
        wrote on 30 Oct 2015, 08:08 last edited by
        #3

        @hskoglund
        No, Im including it in only the tobii.h file.

        1 Reply Last reply
        0
        • H Offline
          H Offline
          hskoglund
          wrote on 30 Oct 2015, 09:11 last edited by
          #4

          Ok, perhaps if you're instead including the tobii.h file in all your .cpp files the errors will also occur.

          D 1 Reply Last reply 31 Oct 2015, 22:06
          0
          • H hskoglund
            30 Oct 2015, 09:11

            Ok, perhaps if you're instead including the tobii.h file in all your .cpp files the errors will also occur.

            D Offline
            D Offline
            dragostej
            wrote on 31 Oct 2015, 22:06 last edited by
            #5

            @hskoglund
            I include the tobii.h file in tobii.cpp and player.h file and thats all.

            1 Reply Last reply
            0
            • H Offline
              H Offline
              hskoglund
              wrote on 31 Oct 2015, 22:23 last edited by
              #6

              Ok, the player.h file, are you including it from more than one .cpp file?

              D 1 Reply Last reply 1 Nov 2015, 13:36
              0
              • H hskoglund
                31 Oct 2015, 22:23

                Ok, the player.h file, are you including it from more than one .cpp file?

                D Offline
                D Offline
                dragostej
                wrote on 1 Nov 2015, 13:36 last edited by
                #7

                @hskoglund
                The player.h file include in player.cpp and mainwindow.h. And the mainwindow.h include in mainwindow.cpp and main.cpp

                1 Reply Last reply
                0
                • H Offline
                  H Offline
                  hskoglund
                  wrote on 1 Nov 2015, 21:57 last edited by
                  #8

                  Ok, try removing the include of player.h in mainwindow.h. (This is what causes the errors it seems).

                  If you then get LNK2019 errors (unresolved external symbols) then you need to change the tobii.h file so it does not include the common.h file, we cross that bridge when we get to it :-)

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    dragostej
                    wrote on 6 Nov 2015, 09:18 last edited by
                    #9

                    Ok, I solved the problem. The problem was, that in the common.h file there were function definitions, so i separated it to .cpp and .h file.
                    Thanks all.

                    1 Reply Last reply
                    0

                    5/9

                    31 Oct 2015, 22:06

                    • Login

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