简体   繁体   English

SDL2.dll 在 QT 中找不到 -lSDL2(QJoystick)

[英]SDL2.dll not found -lSDL2 in QT (QJoystick)

I'm using the QJoystick library in windows and MinGW compiler.我在 windows 和 MinGW 编译器中使用QJoystick库。 I'm working in QTCreator.我在 QTCreator 工作。

I add it to the project.pro file:我将它添加到 project.pro 文件中:

include (./3rdparty/QJoysticks-master/QJoysticks-master/QJoysticks.pri)

And I just include #include <QJoystick> .我只包括#include <QJoystick> And if I'm running the code, I have this errors:如果我正在运行代码,则会出现以下错误:

:-1: error: skipping incompatible [path]\3rdparty\QJoysticks-master\QJoysticks-master\lib\SDL\bin\windows\mingw/SDL2.dll when searching for -lSDL2
:-1: error: skipping incompatible [path]\3rdparty\QJoysticks-master\QJoysticks-master\lib\SDL\bin\windows\mingw/SDL2.dll when searching for -lSDL2
:-1: error: cannot find -lSDL2

My project struct is this:我的项目结构是这样的:

test3
    |-test3.pro
    |-main.cpp
    |-[headers, and other cpp]
    \-3rdparty
        \-QJoysticks-master
            \-QJoysticks-master
                |-QJoysticks.pri
                |-QJoysticks.pro
                |-[readme and etc]
                \-lib
                    \-SDL
                        |-SDL.pri
                        \-bin
                            \-windows
                                \-mingw
                                    |-SDL2.dll
                                \-msvsc
                                    |-SDL2.dll
                            \-mac
                              .
                              .
                              .
                        \-include
                            |-SDL_[xyz].h
                            |-[other SDL[...].h]
                \-src
                    |-QJoysticks.h
                    |-QJoysticks.cpp
                    \-QJoysticks
                        |-[QJoysticks headers]

I'm beginner in C++.我是 C++ 的初学者。

Thanks!谢谢!

My English isn't perfect, sorry.我的英语不是很完美,对不起。

The problem may be caused by 32-bit sdl2 library version.该问题可能是由 32 位 sdl2 库版本引起的。 Just go to the website http://libsdl.org/download-2.0.php then download x64 version and replace the SDL2.dll file in "...\QJoysticks\lib\SDL\bin\windows\mingw" Just go to the website http://libsdl.org/download-2.0.php then download x64 version and replace the SDL2.dll file in "...\QJoysticks\lib\SDL\bin\windows\mingw"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM