Why is my application searching the wrong DLL for a function? - c++

I am writing a Qt Application using Visual Studio 2010. My application 'Review.exe' links against QtAV.dll using QtAV.lib. In turn, QtAV links against ffmpeg, portaudio, gdiplus, etc.
The debug version works correctly.
When I try and run the release version I get:
The procedure entry point GdipAlloc could not be located in the dynamic link library avcodec-54.dll.
GdipAlloc is a part of Gdiplus. Why is the wrong dll being searched for the function? This only happens in the release build.
If I replace the release version of QtAV.dll with the debug version of QtAV.dll, the release version of Review will load the debug version of QtAV.dll.
Setting the linker flag /DEBUG on the release build causes the problem to go away. However I'd like to figure out the cause and a proper solution.

I find that it does happens for vs2010. vs2012 works fine. I compile portaudio by vs2010 again(use cmake is quite easy), and generate FFmpeg .lib files by vs2010 tools, then compile QtAV again, this errors disappears!
I have uploaded new development files to build QtAV. Download FFmpeg-2.0.1_mingw32+msvc.7z and portaudio-v19_msvc2010x86_20130813.7z here: https://sourceforge.net/projects/qtav/files/depends
: )

Related

Application not working on Windows XP, despite using XP toolset. Troubleshoting ideas needed

I'm developing a dll library. My solution (cmake core, Visual Studio sln generated) consists of a few static .lib projects that are used to build this dll and the dll project itself. There are also some 3rd party dependencies (boost, nana and some more). I'm using hell dependencies manager (https://rilis.io/projects/hell) to download my dependencies. I know it's not widely used, but to put it short it is just a simple tool that after reading config file downloads dependencies using git, generates projects using cmake and compiles using the requested generator.
I need my dll to support Windows XP. I develop on Windows 10 machine and I copy the dll to Windows XP SP3 machine, which is where I run the tests. However my dll fails to load on windows xp. LoadLibrary returns nullptr. The name and architecture are matching. I'm not getting any system error, just the pointer returned is nullptr. I used to have system errors but I eliminated them by switching to functions that were present in Windows XP API. I enabled Snapping and ran profiling in DependencyWalker. I got errors about
api-ms-win-core-synch-*
api-ms-win-core-fibers-*
api-ms-win-core-localization-*
failing to load (probably also through dynamic loading during dll initialization. I found out its Windows XP compatibility issue. I figured out that I need to build my module using v140_xp toolset. Cmake provides options to specify toolset and hell is supposed to propagate this setting to build other dependencies using provided toolset. To the best of my knowledge about hell, cmake and visual studio that should be the case. However my dll still fails to load and DependencyWalker + snapping still show the same failed load attempts.
I want to know whether I missed something in my approach or if the toolset setting is not propagated to all static libraries. The second one could cause one or more of dependencies to be compiled with non xp toolset, resulting in linking with non-xp cruntime (I'm linking statically with crt - MTd/MT) and failed dependency.
I need some ideas that would help me troubleshot this issue. Anyone knows how I can check which obj or lib that my dll consists of could add dependency to non-xp API? Or maybe someone has an idea what I could have missed when building my module?
Thank you for your time!

Procedure entry point could not be located Using QT with OpenCV and OpenCV_contrib in Visual Studio

I am using Visual Studio 2017, OpenCV 3.2.0, OpenCV_contrib 3.2.0, QT 5.6.2, and CMake 3.8.2
I had made a program using OpenCV 3.2.0, and it worked previously, but I wanted to use the extra modules in OpenCV_contrib and the GUI in QT with my project, so I recompiled OpenCV with the above versions. I did not change the program at all yet, and when I run the program it builds but I get these two errors, then the program closes:
The procedure entry point
?toLower#QString##QEHAA?AV1#XZ could not be located in the dynamic link library
C:\QT\QT5.6.2\5.6\msvc2015_64\bin\QT5Test.dll
And I get this as well:
The procedure entry point
?toLatin1#QString##QEGBA?AVQByteArray##XZ could not be located in the dynamic link library
C:\opencv\opencv\build\install\x64\vc15\bin\opencv_highgui320.dll.
I have also tried to build the program with
//#include<opencv/highgui.hpp>
commented, but I still get the second error.
I am not sure what this means, and I looked for the file in question and I found it, but I'm not sure what I'm supposed to do after that. Also, I am using Visual Studio when I get these pop up errors. I have not used QT Creator to create a project. This would be my first time.
Thank you.

How can I debug C++ source code of an external native library using Android Studio 2.2.3?

I have an android project created by Android Studio 2.2.3 under Windows 10, this project use a native library through its wrapper jar (through JNI). The native library was built outside of Android Studio by qmake, which will use GCC 4.9 in android NDK r13b to generate the native shared library, the code was compiled with -g option.
To use this native library, I put the wrapper jar under <proj_path>/app/libs directory and the native library under <proj_path>/app/src/main/jniLibs/armeabi-v7a, everything works fine, I can successfully call the method implemented in the native library from java code.
The problem is that when I debug this android project, the breakpoint I set in the cpp file doesn't take effect, please note that the cpp file is not in the source tree of the android project, I just open it from android studio. I have installed the latest LLDB and I start debug with 'Hybrid' debug type, I also use 'image list' LLDB command to confirm that the native library image loaded when debugging is the unstripped version. But the breakpoint just won't hit.
What is wrong with my configuration?
Can somebody give me some suggestion?
Thanks!
How do you expect the AndroidStudio to hit your breakpoint if your program is running over the pre-compiled code? It would be the same if you put a breakpoint in the source-code say in your Notepad++ application. Instead, you have to tell your project/code to use the source-code and not the pre-compiled lib. For this, remove all the .so files and link the source-code so NDK will compile from there.

Qt5Cored.dll missing when trying to run application

I'm using Visual Studio 2013 Ultimate.
My Qt version is 5.2.1
Am using a specific build for VS2013 which I obtained from here.
Now, what I did:
Created a new Qt Application from Visual Studio.
Typed in my logic and the code.
Built it successfully in x64 Debug mode.
Ran the application successfully.
Everything good so far.
Now the problem:
I restart my Visual Studio and load the project.
It is built successfully (in x64 Debug).
Now, am unable to run it. I get the error:
The program can't start because Qt5Cored.dll is missing from your computer.
Try reinstalling the program to fix this problem.
It ran the first time when I created the application. Now it won't run.
I tried simulating the problem, and this happens everytime. Runs the first time, and doesn't run after Visual Studio restart.
Please help me resolve this issue.
Thanks in advance.
From project properties you have to go to debugging -> Environment -> and write PATH=qt5 dll paths Or you have to put the dlls next to the exe.
The first time you in debug mode. Probably in that case Qt5Cored.dll (with a d in the name) was used. Maybe in the second build, you build in release mode, and for some reason Qt5Core.dll is not found in the PATH.
here is what i did and it worked :D
first : make sure you are building a release version not a debug version
second : it asked for the qt5core.dll when you copy it to the same path of your program it may ask for other *.dll files so i put the program in the folder containing all the dlls :D
which is
C:\Qt\Qt5.7.0\5.7\mingw53_32\bin
or according to your installation ..it worked well
any way this folder (as i think) contains all DLL libraries you may need with your program
so to know what exactly you need from it try to start your program many times in another location and in every time you will know another dll needed according to your programming ..
that method worked but i think there may be a more cleaver solutions we have to dig for :)

build gdcm 2.4.1 with cmake and msvc 2010 can't get all the dlls

I build the gdcm following the instruction, no c# wrapping, with GDCM_BUILD_SHARED_LIBS checked (using the cmake-gui), after configured and generated, open the msvc2010 and buildall,
I find the content of the build_dir\bin\debug are all static libs, but where is the dlls? I know little about the cmake, only know how to use the cmake_gui, the problem drives me crazy, any help is appreciated. I have built the gdcm with msvc2008 successfully and it works well, with the dlls generated in the build_dir\bin\debug or build_dir\bin\release.
I should read the tuturial of cmake first, I checked the GDCM_BUILD_SHARED_LIBS, but forgot to reconfigure it, sorry for the foolishness.