[SOLVED] Windows 8.1 doesn't seem to find my dll (startup error 0xc0000135)
-
Hey,
I am writing a Qt 5.3 Widgets application on my Windows 7 (x64) desktop PC, which works fine so far.
Now I want to continue writing the same application on my Windows 8.1 (x64) notebook... outside in the sun and stuff... !So I got myself a SVN server and created a working copy of my project on my notebook (via the windows explorer... not the built-in Qt version control).
I can compile the project just fine, but I can neither run, nor debug.
The debugger throws: "During Startup program exited with error code 0xc000135".
The compiler on both machines is MinGW 4.8.2 32bit.
Both Qt-Creators are 3.1.2 based on Qt 5.3.1.This HAS to do with the hidapi.dll I am linking to.
Can you please have a look at my project file and tell me why Windows 7 knows what to do and Windows 8.1 doesn't?@QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
TARGET = myApp
TEMPLATE = appSOURCES += main.cpp
mainwindow.cpp
qcustomplot.cpp \HEADERS += mainwindow.h
../../HIDAPI/hidapi.h
qcustomplot.h \FORMS += mainwindow.ui
#-------------------------------------------------
Add the Signal11's hidapi library that was
created
#-------------------------------------------------
win32: LIBS += -LD:\SVN\HIDAPI\windows -lHIDAPI#-------------------------------------------------
Make sure to add the required libraries or
frameoworks for the hidapi to work depending on
what OS is being used
#-------------------------------------------------
win32: LIBS += -lSetupAPI#-------------------------------------------------
Make sure output directory for object file and
executable is in the correct subdirectory
#-------------------------------------------------
win32 {
DESTDIR = windows
OBJECTS_DIR = windows
MOC_DIR = windows
UI_DIR = windows
RCC_DIR = windows
}@To be honest, I haven't figured out exactly how to add an external library.
The code above is mostly a courtesy of the internets.The folder structure on my desktop and my notebook are exactly the same and the needed dll is also present on both machines.
The qt-project-file is found in "D:\SVN\myApp\myApp\myApp.pro"
The HIDAPI dll is found in "D:\SVN\HIDAPI\windows\hidapi.dll"Cross platforming a minimalistic "Hello World" application from Windows 7 to 8.1 worked without any problems.
Can you help?
Thank you!schmaunz.
-
Hi, just guessing but maybe. even though hidapi.dll is loading fine on your 8.1 system, it has some dependency. You could try Dependency Walker, load your .exe file and start Profile to see what dlls are loaded. and where it fails on 8.1.
-
Thanks hskoglund,
dependency walker does indeed find the hidapi.dll but the following ones are missing:
@MSVCR120D.DLL
API-MS-WIN-APPMODEL-RUNTIME-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL
API-MS-WIN-SHCORE-SCALING-L1-1-1.DLL
DCOMP.DLL
IESHIMS.DLL@I do not have said files on my notebook, because I never installed Visual Studio on that one.
The PC however has the Visual C++ Redistributable Packages installed, because Qt asked for the VS debugger after its first installation.Right now I have Qt installed on both machines with only MinGW checked, precisely because I want my creation to be able to run on non Microsoft machines at some time in the distant future.
So what now?
I assume there is a way to run Qt applications without the need of the Visual C++ Redistributable Packages, isn't there?What am I doing wrong?
-
Hi, the missing DLLs are almost all false positives which you can disregard, except that MSVCR120D.DLL. It's the debug flavored DLL for MSVC 2013, not included in any Redistributable Packages. I.e. the normal MSVCR120.DLL is in there, but not the *D suffixed chap.
Since you're using MinGW it has to be some other .DLL that has a dependency on MSVC 2013 debug mode. Maybe hidapi.dll is built using Visual Studio?
-
Yes, you are absolutely right.
Dependency Walker says hidapi.dll depends on
@SETUPAPI.DLL
KERNEL32.DLL
MSVCR120D.DLL@I would love to build my own hidapi.dll or to link it statically.
Unfortunally I don't know how :(I think in the HIDAPI zip-file
https://github.com/signal11/hidapi/downloads
are all the components neccessary to build it using Qt.
Do you know of a tutorial I can understand? -
Just looked at hidapi on GitHub, seems like a neat library, just one .c file, should be possible to build using Qt. Don't know any tutorial offhand, but some coffee and I could try it.
Meanwhile, I downloaded the package, opened it in my MSVC 2013, changed the build mode from Debug to Release, compiled/zipped/uploaded to http://www.tripleboot.org/Qt/Release.zip
In it is a hidapi.dll that depends on MSVCR120.DLL maybe it's useful for you :-)
-
I got a little carried away by your blog. Good stuff :)
Sadly my notebook doesn't know about the MSVCR120.DLL either.
As mentioned, I don't know anything about compiling dlls, so I don't know how much to thank you if you could manage to port(?) HIDAPI to Qt, but I think "a lot" sounds about right ;)
If I'll learn something on the way, even better!
But first I have to get some sleep.
-
I found something on google:
https://code.google.com/r/tranthangtbc-ewh-bp-project/source/browse/trunk/PIC_code/BP+USB+code/PnP+Demo+-+Cross+Platform+Software/HIDAPI?name=branch-simple-appIt seems to be a part of this project: https://code.google.com/p/ewh-bp-project/, but I can't find any references leading towards it from there.
Anyway, it is a Qt project that is compiling a static hidapi library, which I am then able to link to myApp with the following project code:
@# HIDAPI needs this
win32: LIBS += -lSetupAPIAuto generated code to link HIDAPI statically
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/hidapi/windows/ -lHIDAPI
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/hidapi/windows/ -lHIDAPIdINCLUDEPATH += $$PWD/hidapi/windows
DEPENDPATH += $$PWD/hidapi/windowswin32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/hidapi/windows/libHIDAPI.a
else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/hidapi/windows/libHIDAPId.a
else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/hidapi/windows/HIDAPI.lib
else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/hidapi/windows/HIDAPId.lib@It is using an old HIDAPI revision, but it is a start.
Their project-file to create the library doesn't look too complicated. -
Hi, just tested porting hidapi to Qt 5.31 MinGW 32-bit: created a simple widgets app, downloaded a fresh zip from https://github.com/signal11/hidapi , copied hid.c and hidapi.h into my Qt project and then tried the hid_enumerate() call in a loop, just displaying VIDs and PIDs in a listwidget.
Seems to work fine :-)Pretty straightforward, only problem I got was that you need to locate a file from Microsoft called Setupapi.lib on your C: and then specify the path to it in the .pro file. In my case (using Windows XP) the path contained spaces, so had to use $$quote, e.g.
@
...
LIBS += $$quote(C:/Program Files/Microsoft SDKs/Windows/v6.0A/Lib/SetupAPI.lib)
...
@I've uploaded a zip with my project: http://www.tripleboot.org/Qt/Hidtest.zip
-
Now that's almost too easy :)
Thank you!Since there will be no further libraries involved, it compiles rather fast and the HIDAPI-license allows me to use the source any way I want, I think that's the path I'll follow.
[quote author="hskoglund" date="1406259726"][...] only problem I got was that you need to locate a file from Microsoft called Setupapi.lib [...][/quote]
I know, but in Windows 7 and 8 it works fine if you link the SetupAPI like this:
@win32: LIBS += -lSetupAPI@Would you like to try if it works on WinXP, too?
And to keep the cross-platformness alive I think this would work, although at the moment I have no means to test this on non Windows machines
(note: I changed the folder structure a little bit to my liking)
@#-------------------------------------------------Project created by QtCreator 2014-07-25T04:07:09
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = HidTest
TEMPLATE = appSOURCES += main.cpp
mainwindow.cppHEADERS += mainwindow.h \
FORMS += mainwindow.ui
#-------------------------------------------------
Add cross-platform HIDAPI header
#-------------------------------------------------
HEADERS += hidapi/hidapi.h#-------------------------------------------------
Add appropriate HIDAPI source file depending on OS
#-------------------------------------------------
macx: SOURCES += hidapi/mac/hid.c
unix: !macx: SOURCES += hidapi/linux/hid-libusb.c
win32: SOURCES += hidapi/windows/hid.c#-------------------------------------------------
Add required libraries or frameworks for the
HIDAPI to work depending on what OS is being used
#-------------------------------------------------
macx: LIBS += -framework CoreFoundation -framework IOkit
win32: LIBS += -lSetupAPI
unix: !macx: LIBS += -lusb-1.0@Thank you very much for your help and for your blog posts. I suppose they will be very helpful in the not so distant future :)