matOpen with VS2015 and Matlab 2017b
4 views (last 30 days)
Show older comments
I'm trying to run the sample program matcreat.cpp (MATLAB\R2017b\extern\examples\eng_mat\) using Visual Studio 2015 and Matlab 2017b. I've created the project in Release, with x64 as the platform option. I'm setting the library path of the project to "MATLAB\R2017b\extern\lib\win64\microsoft\" and I'm including the libraries libmat.lib, libmex.lib, and libmx.lib. I've commented out most of matcreat.cpp to localize the issue, so matcreat.cpp only looks like this at the moment:
#include <stdio.h>
#include <string.h> /* For strcmp() */
#include <stdlib.h> /* For EXIT_FAILURE, EXIT_SUCCESS */
#include "mat.h"
#define BUFSIZE 256
int main() {
MATFile *pmat;
mxArray *pa1, *pa2, *pa3;
double data[9] = { 1.0, 4.0, 7.0, 2.0, 5.0, 8.0, 3.0, 6.0, 9.0 };
const char *file = "mattest.mat";
char str[BUFSIZE];
int status;
printf("Creating file %s...\n\n", file);
pmat = matOpen(file, "w");
printf("Done\n");
return(EXIT_SUCCESS);
}
I'm able to compile this (which also means that the libmat.lib is being found and linked properly), but when I execute from a command window (or double-clicking on the executable) I get the following error window: "The application was unable to start correctly (0xc000006b). Click OK to close the application." If I comment out the line with matOpen, I'm able to compile and execute, so the error appears only related to trying to execute the matOpen command.
Similarly, when I try using Matlab mex command to compile matcreat.cpp, I'm also able to compile but not execute.
Any ideas?
0 Comments
Answers (0)
See Also
Categories
Find more on C Matrix API in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!