Search code examples
c++qtqt-creatorvirtualjoystick

Multiple Undefined References - Qt Creator - vJoy C++


Edit

It was pointed out that I should be using MS VC++ rather than MinGW, this seems to result in a different issue for me:

2 Unresolved External Symbols

  1. __imp_SetWindowsHookExW
  2. __imp_UnhookWindowsHookEx

As seen here: image1

Each of these trace into WinUser.h here:

img2

Should I make and entirely new post for this? - or revise the current post?


Original Post :

I'm trying to re-build a program which maps Mouse input to a "Virtual Joy Stick" using libraries from vJoy

The original project can be found here: MouseToJoystick

I have not changed anything in the program, and I am attempting to compile it within QT Creator, using QT 5.10.0 - I am not certain if I have the "Build Settings" setup correctly.


Here is the current list of compile Warnings and Errors:

Qt Creator Errors (*image*)

As far as I can tell, each of the "undefined references" listed is a function which can be traced into "vJoyInterface.h" which is included in the file "MainWindow.cpp" where the "undefined references" take place.

Project **Directory** Structure (*image*)

MainWindow.cpp #includes (image)

And here are the "prototypes" for the function said to be "undefined" in the "vJoyInterface.h" file:

vJoyInterface Header (image)


So, at the very least the "prototypes" for the functions exist - although the functions may still be undefined - other answers I've seen say that the project need to somehow include/link the appropriate library that contains the definitions for the functions.

The only other files related to vJoy are in the "vJoyLib/64" and "vJoyLib/32" folder. Which both contain these files:

vJoyLib folder Libraries (*image*)

This library is referenced in the "MouseToJoystick.pro" file, as seen here:

Qt Project Linking vJoyInterface (*image*)

My assumption is that the vJoy functions are defined somewhere in the "vJoyInterface.lib" but I have no idea, and I don't know how to check.


TL;DR

QT Creator says there are "undefined references" but I know the prototypes have been included, and I assume that they are defined in a library linked to the project as seen in this image:

Qt Project Linking vJoyInterface (image)

But I honestly have no idea where the functions are actually defined, or if the library is being linked correctly.


Questions

  1. How can I figure out where the functions are actually being defined OR how can I properly include the library/definitions in my project?
  2. Why do each of the functions have '_imp__' added on the beginning in the error message?

Additional Information

Qt Creator - Project Build Settings - Qt 5.10.0 MinGW 32bit


Solution

  • @AlexanderVX provided this answer in a comment to my question

    After switching from MinGW to MS VC++ in the project compile settings, I added 1 line of code to my "MouseToJoystick.pro" file.

    Here is the new line of code:

    Project File code (image)

    After that I did "Clean All", "Run Qmake", and "Rebuild All" as seen in this image:

    Steps (image)

    The program compile and runs perfectly, thank you @AlexanderVX