hfdd 03图解.obj : error LNK2001: unresolved external symbol _prnitf

当前位置: →
→ error LNK2001:unresolved external symbol imp编译错误解决方法
error LNK2001:unresolved external symbol imp编译错误解决方法
& 作者及来源: 龖龖 - 博客园 &
&收藏到→_→:
摘要: error LNK2001:unresolved external symbol __imp__编译错误解决方法
"error LNK2001:unresolved external symbol imp编译错误解决方法"::
编译错误提示:dialogapp.obj : error lnk2001: unresolved external symbol __imp__initcommoncontrols@0debug/dialogapp.exe : fatal error lnk1120: 1 unresolved externals
1、分析错误主要在于initcommoncontrols这个api函数的调用是出现错误
2、msdn中参考initcommoncontrols函数
minimum dll version
comctl32.dll
commctrl.h
import library
comctl32.lib
其实,我们在建立这个工程的时候我们建立的是一个win32 application的一个空工程,所以在工程设置缺少comctl32.lib文件的,可以通过下面两种方法之一来解决这个错误:
一、在程序中加入语句
#pragma comment(lib,"comctl32.lib")
二、菜单&工程&--&设置&--标签&连接&中的& 工程选项(d)中加入comctl32.lib
但在阅读了/kb/238721这篇文章后,我们还可以动态地加载和初始化 comctl32.dll 文件,来解决这个错误搜索此文相关文章:此文来自: 马开东博客
网址: 站长QQ
error LNK2001:unresolved external symbol imp编译错误解决方法_博客园相关文章
博客园_总排行榜
博客园_最新
博客园_月排行榜
博客园_周排行榜
博客园_日排行榜当前位置: →
→ error LNK2001:unresolved external symbol imp编译错误解决方法
error LNK2001:unresolved external symbol imp编译错误解决方法
& 作者及来源: 龖龖 - 博客园 &
&收藏到→_→:
摘要: error LNK2001:unresolved external symbol __imp__编译错误解决方法
"error LNK2001:unresolved external symbol imp编译错误解决方法"::
编译错误提示:dialogapp.obj : error lnk2001: unresolved external symbol __imp__initcommoncontrols@0debug/dialogapp.exe : fatal error lnk1120: 1 unresolved externals
1、分析错误主要在于initcommoncontrols这个api函数的调用是出现错误
2、msdn中参考initcommoncontrols函数
minimum dll version
comctl32.dll
commctrl.h
import library
comctl32.lib
其实,我们在建立这个工程的时候我们建立的是一个win32 application的一个空工程,所以在工程设置缺少comctl32.lib文件的,可以通过下面两种方法之一来解决这个错误:
一、在程序中加入语句
#pragma comment(lib,"comctl32.lib")
二、菜单&工程&--&设置&--标签&连接&中的& 工程选项(d)中加入comctl32.lib
但在阅读了/kb/238721这篇文章后,我们还可以动态地加载和初始化 comctl32.dll 文件,来解决这个错误搜索此文相关文章:此文来自: 马开东博客
网址: 站长QQ
error LNK2001:unresolved external symbol imp编译错误解决方法_博客园相关文章
博客园_总排行榜
博客园_最新
博客园_月排行榜
博客园_周排行榜
博客园_日排行榜Vs2006+matlab2010rb环境:
1:工具-选项-项目解决方案-VC++目录设置include和lib的路径
2:项目-属性-属性配置-链接器-输入-附加依赖项把库的名字添加进去
VISTA+MATLAB2009a+VS2010
以安装路径&E:\Program Files\MATLAB\R2009a\&为例
MATLAB外部支持文件夹:E:\Program Files\MATLAB\R2009a\externmatlab自带的c例程:E:\Program Files\MATLAB\R2009a\extern\examples\eng_mat
engine.h的位置:E:\Program Files\MATLAB\R2009a\extern\include
各种lib的位置:E:\Program Files\MATLAB\R2009a\extern\lib\win32\microsoft
在matlab帮助中输入&C language&即可找到有关MATLAB Engine的一个页面。从这个页面开始,学习各种关键词,就能够找到一切你需要的资料。
使用MATLAB Engine一般用两套函数就可以了。1.engXXXX,关于Engine本身的操作,包括打开/关闭,设置/取得变量,执行语句等等。2.mxXXXX,关于数据类型mxArray的操作,与MATLAB交互的左右类型全部为mxArray。
》》一个搭建实例
先在VS2010的&项目-&属性-& VC++目录-&包含目录&下加上:
include files:E:\Program Files\MATLAB\R2009a\extern\include
项目-&属性-& VC++目录-&库目录&下加上
library files:E:\Program Files\MATLAB\R2009a\extern\lib\win32\microsoft
做好这些后,如果我们环境一样,下面的代码应该能够编通并且正常执行,其中包含了常用的一些函数,一般来说使用Engine的时候也就用这些了。
#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 *&&&&int i ,
&&&&//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] ;&&&&&&&&ndims = mxGetNumberOfDimensions(X) ;&&&&printf("total number of dimensions is %d\n" , ndims) ;&&&&memcpy(dims , mxGetDimensions(X) , ndims * sizeof(int)) ;&&&&for ( i = 0 ; i & 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;}
》》某些问题
如果出现这个:
engdemo.obj : error LNK2001: unresolved external symbol _engCloseengdemo.obj : error LNK2001: unresolved external symbol _engSetVisibleengdemo.obj : error LNK2001: unresolved external symbol _mxDestroyArrayengdemo.obj : error LNK2001: unresolved external symbol _mxGetDataengdemo.obj : error LNK2001: unresolved external symbol _mxGetDimensions_730engdemo.obj : error LNK2001: unresolved external symbol _mxGetNumberOfDimensions_730engdemo.obj : error LNK2001: unresolved external symbol _engGetVariableengdemo.obj : error LNK2001: unresolved external symbol _engEvalStringengdemo.obj : error LNK2001: unresolved external symbol _engPutVariableengdemo.obj : error LNK2001: unresolved external symbol _mxGetPrengdemo.obj : error LNK2001: unresolved external symbol _mxCreateDoubleMatrix_730engdemo.obj : error LNK2001: unresolved external symbol _engOpen
其实就是lib没有添加好。
在代码中写上:#pragma comment(lib,"libeng.lib")&#pragma comment(lib,"libmx.lib")就可以了。
PS: #pragma comment( comment-type ,["commentstring"] )
comment-type是一个预定义的,指定注释的类型,应该是compiler,exestr,lib,linker之一。
commentstring是一个提供为comment-type提供附加信息的字符串。
我们经常用到的是#pragma comment(lib,"*.lib")这类的。#pragma comment(lib,"Ws2_32.lib")表示链接Ws2_32.lib这个库。 和在工程设置里写上链入Ws2_32.lib的效果一样,不过这种方法写的 程序别人在使用你的代码的时候就不用再设置工程settings了
或者可以在工程的连接设置里面添加这两个库。不过我倾向于前者,这样在发布源码的同时,就尽最大可能地保证能够编译,而不用其他人学习的时候再去设置。
当然,由于#pragma是由编译器自己决定的,所以代码的可移植性存在一些问题。
如果还是报上面的错误,估计是没有将lib的路径添加对。具体参考上面的那个实例,然后注意把路径换成自己机器上的。
阅读(...) 评论()温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!&&|&&
LOFTER精选
网易考拉推荐
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
阅读(2984)|
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
历史上的今天
loftPermalink:'',
id:'fks_094074',
blogTitle:'VC++出现error LNK2001: unresolved external symbol __imp__',
blogAbstract:'例如:
Compiling...VideoPlayer.cppLinking...DIGITALVIDEO.OBJ : error LNK2001: unresolved external symbol '
{list a as x}
{if x.moveFrom=='wap'}
{elseif x.moveFrom=='iphone'}
{elseif x.moveFrom=='android'}
{elseif x.moveFrom=='mobile'}
${a.selfIntro|escape}{if great260}${suplement}{/if}
{list a as x}
推荐过这篇日志的人:
{list a as x}
{if !!b&&b.length>0}
他们还推荐了:
{list b as y}
转载记录:
{list d as x}
{list a as x}
{list a as x}
{list a as x}
{list a as x}
{if x_index>4}{break}{/if}
${fn2(x.publishTime,'yyyy-MM-dd HH:mm:ss')}
{list a as x}
{if !!(blogDetail.preBlogPermalink)}
{if !!(blogDetail.nextBlogPermalink)}
{list a as x}
{if defined('newslist')&&newslist.length>0}
{list newslist as x}
{if x_index>7}{break}{/if}
{list a as x}
{var first_option =}
{list x.voteDetailList as voteToOption}
{if voteToOption==1}
{if first_option==false},{/if}&&“${b[voteToOption_index]}”&&
{if (x.role!="-1") },“我是${c[x.role]}”&&{/if}
&&&&&&&&${fn1(x.voteTime)}
{if x.userName==''}{/if}
网易公司版权所有&&
{list x.l as y}
{if defined('wl')}
{list wl as x}{/list}

我要回帖

更多关于 hfdd 01 的文章

 

随机推荐