Invalid MEX-file - Compiled with VisualStudio 2013 - c++

I have a .mexw32-file which is compiled in VisualStudio 2013 and i try to call that function in Matlab 2013. The mex-file use a libary ("plug_feedfwd.lib") to control a mirror.
I can compile the project in VS2013 without failures and warnigns, so it seems that all libarys and header-files are included correctly.
But if i try to call the mex-file in Matlab, it trows the following exception:
"Invalid MEX-file -pathOfTheMexFile-: The specified module could not be found."
If I comment all lines where methodes call the libary, the mex-file works in matlab. So it seems that Matlab got a problem with this library, but VisualStudio can deal with it.
I have found this link but it didnt help much:
http://de.mathworks.com/help/matlab/matlab_external/invalid-mex-file-error.html
The matlab-version must be compatible cause i can call the mex-function if i dont use methodes from the library.
The dependencywalker show always missing librarys, also if the mex-function works - and if i use my invalid mexfile the missing librarys are the same as before
I also tryied to copy all librarys in the same folder as the mex-file
My System:
Windows 8.1 x64,
Matlab 2013 x32,
Visual Studio: 2013,
Mex-function: x32,
has anyone a idear what can i try next?
gereetings, Stefan

Related

cv:Exception at memory location - Running openCV code Visual studio 2013 & Visual studio 2017 - Windows 7

How can I get rid of Exceptions in Visual Studio? Possibly from project exception settings?
I am using openCV 2.4.9 library with c++ code library in Visual studio. when I run the code. I tried library with 2012 & 2015 also but had "lnk1104" error for missing library file . I tried resolving those with solutions found from internet ( redistributable c++ package & others) but couldn't fix it.
So I tried in 2013 & 2017, but get the unhandled exceptions(Microsoft C++ exception: cv::Exception at memory location 0x0037AD58(& other locations too)) for both versions.
I have been trying to run code successfully since last 3 days.
Can anyone please help me?
Thanks in advance.
exceptions are baked into the code, so you can't rid of them. The best you can do is to use try catch
try
{
my_exception_throwing_function();
}
catch(err)
{
}
But in your case I think it's a linker problem. You need to tell the compiler where all the binaries of OpenCV. Check the linker page of the compiler.
Did you recompile OpenCV yourself? Did you use precompiled binaries? if so, were the binaries compiled with the same compiler you are using? Which version of OpenCV are you using?
I would go to the documentations of OpenCV, they have good guides to setup the toolchain.
https://docs.opencv.org/2.4/doc/tutorials/introduction/windows_visual_studio_Opencv/windows_visual_studio_Opencv.html

lib built in vs c++ 2005 How to use them in vs 2017?

I have the following problem: I have a library, let's call it library.lib that is written in VS C++ 2005. In VS 2017 I've got the following error when compiling:
LINK : fatal error C1047: The object or library file 'library.lib' was created with an older compiler than other objects; rebuild old objects and libraries
Could you help me to solve it? Possibly I have to run VS 2005. However, I cannot install it. I have Windows 10 and the installer does not work.
Pol
is there anybody here, who might help, the project cannot wait?

How to use Eigen library for Arduino within Atmel Studio 7?

I tried to use Eigen library within the Arduino IDE fist. Then I got the error:
fatal error: eigenfolder/Eigen/Dense: No such file or directory
Then I tried to use EigenArduino library. Then I got an error
fatal error cstddef No such file or directory #include cstddef
So I realized that there is probably a lot of standard library that is not linked/implemented into this Arduino IDE. So before getting everythin I decided to move into ATMEL STUDIO 7. My hope was that Atmel Studio gets everything automatically.
But in order to use my previous Arduino Sketches, I also installed Visual Micro that is a Plug-In for Atmel Studio so that you can use everything like in the Arduino IDE.
==> So the problem starts all over again. Same errors in Atmel Studio 7. It seems like I am just using the Atmel Studio 7 Editor now, but the same compiler settings, libraries etc. (Since I am a newbie :-) this is just a guess ).
How can I link all this together? Can somebody please help?
How did you add the library ?
Did you use libraries manager in Arduino IDE ?
Or you downloaded the library separately ?
I found out that using libraries manager solve most compatibility issues.

LoadLibrary failed. Error 127

I have an executable C++ project (VS2008) which calls dll (VS2008). And that DLL also calls DLL (VS2012) which uses OpenCV. On the computer where Visual Studio is it works fine. But I have "LoadLibrary failed. Error 127" while trying to execute the same pack of files on another computer.
I've already checked the files with Dependency Walker and added all the DLLs missing.
The problem was in the version of the OpenCV dll's. Used vc10 instead of vc11 and it worked.

Installing OpenCV 2.4.10 on Windows 8.1 with VS 2013

I am trying to install opencv 2.4.10 on Windows 8.1. Normally I install OpenCV without any third party libraries but this time I am trying to install some libraries like CStripes, Eigen, OpenExr, CUDA 6.5, AMD Blas and Fft.
I am using Visual Studio 2013 64-bit. OpenCV installation without any third party library completes without any issues but with 3rd party libraries it is unsuccessful. I was following the installation procedure given here.
The issue that I noticed is that during the installation the system cannot find the .lib and .dll files e.g.
LINK : fatal error LNK1181: cannot open input file '..\..\lib\Release\opencv_contrib2410.lib'
file INSTALL cannot find "E:/opencv/build/bin/Release/opencv_gpu2410.dll".
I ran the installation as an admin but I was still getting the same errors.
You can view the Visual Studio build log here and Cmake build log here.
Please help me out.
Search for "Error" in the Visual Studio logs. There is clearly a CUDA error being thrown:
E:/opencv/sources/modules/gpu/src/nvidia/core/NCV.cu(356): error : namespace "std" has no member "max"
It seems as though you need to add #include <algorithm> for this to work (as suggested here).
I would also suggest that you raise this as a bug on the OpenCV tracker!