VS 编程常见错误及解决方法
1. VS2013 无法打开包括文件:“cv.h"等一些头文件
解决方法:
错误一:必须属性”VSIstallDir”缺失或为空
解决方式:选择菜单栏的项目->属性->配置属性->常规->平台集成工具,选择V90编辑为V100,点击确定。之后运行就不会再出现必须属性”VSInstallDir”缺失或为空的错误了。
错误二:找不到projectname.exe
解决方式:
1、选择菜单栏的项目->属性->配置属性->VC目录->包含目录->编辑
添加:matlab安装目录\extern\include,然后点击确定
2、选择菜单栏的项目->属性->配置属性->VC目录->库目录->编辑
添加:matlab安装目录\extern\lib\win64\microsoft
3、选择菜单栏的项目->属性->配置属性->C++->常规->附加包目录->编辑,添加:libmx.lib;libeng.lib;libmat.lib; 点击确定
4、选择菜单栏的项目->属性->配置属性->链接器->输入->附加依赖项->编辑,添加:libmx.lib;libeng.lib;libmat.lib; 点击确定
5、选择菜单栏的解决方案平台,选择win64(倘若没有这个选项,则选择配置管理器->选择平台->新建->选择win64->确定即可)
最后得到运行结果:
附上测试代码:
#include "stdafx.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "engine.h"
#include "matrix.h"
#pragma comment(lib,"libeng.lib")
#pragma comment(lib,"libmx.lib")
int main()
{
Engine *ep;
int i , j ;
//show how to open MATLAB engine
//for remote ones:
//engOpen( ADDRESS OF REMOTE SYSTEM ) ;
if (!(ep = engOpen("\0"))){
fprintf(stderr, "\nCan't start MATLAB engine\n");
return EXIT_FAILURE;
}
//show how to create matrix
mxArray *Y = mxCreateDoubleMatrix(1 , 3 , mxREAL) ;
//show how to put data in matrix
double tmp[3] = {1.0 , 2.0 , 3.0} ;
memcpy(mxGetPr(Y) , tmp , sizeof(tmp)) ;
//show how to put variables in the Engine
engPutVariable(ep , "Y" , Y) ;
//show how to execute commands in MATLAB
engEvalString(ep, "X = ones(5,1) * Y");
//show how to get variables from the Engine
mxArray *X = engGetVariable(ep , "X") ;
//show how to manipulate dimensions
int dims[10] ;
int ndims ;
ndims = mxGetNumberOfDimensions(X) ;
printf("total number of dimensions is %d\n" , ndims) ;
memcpy(dims , mxGetDimensions(X) , ndims * sizeof(int)) ;
for ( i = 0 ; i < ndims ; i ++ ){
printf("dimension %d : %d\n" , i , dims[i]) ;
}
printf("\n") ;
//show how the data is stored in the memory
double *p = (double*)mxGetData(X) ;
for ( i = 0 ; i < dims[0] ; i ++ ){
for ( j = 0 ; j < dims[1] ; j ++ ){
printf("%8.2f" , p[j * dims[0] + i]) ;
}
printf("\n") ;
}
//---important, to release resources
mxDestroyArray(X) ;
mxDestroyArray(Y) ;
//show how to hide and unhide MATLAB command window
printf("type RETURN to hide the MATLAB command window...\n") ;
getchar() ;
engSetVisible(ep , false) ;
printf("type RETURN to unhide the MATLAB command window...\n") ;
getchar() ;
engSetVisible(ep , true) ;
printf("type RETURN to END this program...\n") ;
getchar() ;
//remembering to close it is important .
//but if you are debugging your programs ,
//annotate the following line will save you a lot of time ,
//for you needn't to restart the Engine .
engClose(ep) ;
//when your work is accomplished , type "exit" in MATLAB command window
return EXIT_SUCCESS;
}
VS 编程常见错误及解决方法的更多相关文章
- Servlet常见错误及解决方法
常见错误及解决方法 1. 404产生的原因为Web服务器(容器)根据请求地址找不到对应资源,以下情况都会出现404的错误提示: 输入的地址有误(应用名大小写不正确,名称拼写不正确) 在web.xml文 ...
- IIS7常见错误及解决方法
IIS7常见错误及解决方法 问题一:HTTP 错误 500.19 - Internal Server Error 无法访问请求的页面,因为该页的相关配置数据无效. 详细错误信息模块 IIS We ...
- 微信jssdk常见错误及解决方法
调用config 接口的时候传入参数 debug: true 可以开启debug模式,页面会alert出错误信息.以下为常见错误及解决方法: invalid url domain当前页面所在域名与使用 ...
- centos linux 系统日常管理4 scp,rsync,md5sum,sha1sum,strace ,find Rsync 常见错误及解决方法 第十七节课
centos linux 系统日常管理4 scp,rsync,md5sum,sha1sum,strace ,find Rsync 常见错误及解决方法 第十七节课 rsync可以增量同步,scp不行 ...
- WCF项目中出现常见错误的解决方法:基础连接已经关闭: 连接被意外关闭
在我们开发WCF项目的时候,常常会碰到一些莫名其妙的错误,有时候如果根据它的错误提示信息,一般很难定位到具体的问题所在,而由于WCF服务的特殊性,调试起来也不是那么方便,因此往往会花费不少时间来进行跟 ...
- cmd常见错误及解决方法
[英文] Bad command or file name [译文] 错误的命令或文件名 错误原因和解决: 这大概是大家最常见到的错误提示了,它的意思是输入的命令无效.当输入的命令既不是DOS内部命令 ...
- jmeter常见错误及解决方法
jmeter常见错误: 错误一: Response code: Non HTTP response code: java.net.SocketTimeoutException Response m ...
- Android 源码编译及常见错误及解决方法
最近要往arm开发板上移植android系统,大大小小的问题遇到了太多太多,都是泪啊.本人初接触嵌入式开发,对问题的根源不是太了解,不过好在每解决一个问题,便记录一下.话不多说,正式罗列问题: hos ...
- Rsync 常见错误及解决方法
由于阿里云SLB不提供ECS间的数据同步服务,如果部署在SLB后端ECS上的应用服务是无状态的,那么可以通过独立的ECS或RDS服务来存储数据:如果部署在SLB后端ECS上的应用服务是有状态的,那么需 ...
随机推荐
- Rectangle and Square(判断正方形、矩形)
http://acm.sdut.edu.cn:8080/vjudge/contest/view.action?cid=42#problem/D 改了N多次之后终于A了,一直在改判断正方形和矩形那,判断 ...
- BZOJ1603: [Usaco2008 Oct]打谷机
1603: [Usaco2008 Oct]打谷机 Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 602 Solved: 458[Submit][Stat ...
- ☀【HTML5】Modernizr
Modernizr 使用Modernizr探测HTML5/CSS3新特性
- 【转】android 完全退出应用程序
原文网址:http://www.yoyong.com/archives/199 android退出应用程序会调用android.os.Process.killProcess(android.os.Pr ...
- 织梦CMS(dedecms)栏目属性及系统封面模板、列表模板、文章模板区别和路径设置解答
问题一:(织梦"栏目管理"的"常规选项"中3个栏目属性分析?) 织梦CMS的栏目属性分成三种, -->最终列表栏目 -->频道封面 -->外部 ...
- 深入hibernate的三种状态【转载】
这篇文章写得很好,举了很多例子. http://www.cnblogs.com/xiaoluo501395377/p/3380270.html
- JavaScript函数柯里化的一些思考
1. 高阶函数的坑 在学习柯里化之前,我们首先来看下面一段代码: var f1 = function(x){ return f(x); }; f1(x); 很多同学都能看出来,这些写是非常傻的,因为函 ...
- Google辅助类软件
本博文的主要内容有 .Google辅助类软件的介绍 .重点首推! Google软件精选管理器 1.Google辅助类软件的介绍 1. Google软件精选管理器的下载和安装使用 2. Googl ...
- 查看线程linux cpu使用率
Linux下如何查看高CPU占用率线程 LINUX CPU利用率计算 转 http://www.cnblogs.com/lidabo/p/4738113.html目录(?)[-] proc文件系统 p ...
- bzoj4443 SCOI2015 小凸玩矩阵 matrix
传送门:bzoj4443 题解 很水的一道网络流,显然可以二分答案,然后我们希望第\(k\)大尽量小,那么对于一个\(mid\),我们应尽量选择更小的,然后跑二分图最大匹配来验证. code