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 Updated to NodeBB v4.3 + New Features

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 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
    • hskoglundH Offline
      hskoglundH Offline
      hskoglund
      wrote on 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
      0
      • hskoglundH hskoglund

        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 last edited by
        #3

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

        1 Reply Last reply
        0
        • hskoglundH Offline
          hskoglundH Offline
          hskoglund
          wrote on 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
          0
          • hskoglundH hskoglund

            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 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
            • hskoglundH Offline
              hskoglundH Offline
              hskoglund
              wrote on last edited by
              #6

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

              D 1 Reply Last reply
              0
              • hskoglundH hskoglund

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

                D Offline
                D Offline
                dragostej
                wrote on 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
                • hskoglundH Offline
                  hskoglundH Offline
                  hskoglund
                  wrote on 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 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

                    • Login

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