0
我想在matlab中使用clllib函数,我把.dll文件和.h文件放在与开发的.m MATLAB文件相同的目录下,之后我尝试使用loadlibrary function bui它有一些警告将matlab连接到c语言的DLL
警告:
Warning:
Message from C preprocessor:
lcc preprocessor error: C:\Users\MAHNAZ\Documents\MATLAB\T1Header.h:1 Could not find include file
<iostream>
lcc preprocessor warning: C:\Users\MAHNAZ\Documents\MATLAB\T1Header.h:21 EOF inside comment
> In loadlibrary at 351
Warning: The function 'Add' was not found in the library
> In loadlibrary at 435
Warning: The function 'Function' was not found in the library
> In loadlibrary at 435
,当我想用calllib
功能就像这样:calllib('t1', 'Add', 2,3)
MATLAB给我一个错误:
??? Error using ==> calllib Method was not found.
我的头文件是:
#ifndef T1_HEADER_H
#define T1_HEADER_H
extern int Add(int a, int b);
extern void Function(void);
#endif
我的源文件是:
#include iostream
#include "T1Header.h"
extern int Add(int a, int b)
{
return(a + b);
}
extern void Function(void)
{
std::cout << "DLL Called!" << std::endl;
}
我使用Visual C++ 2010和Matlab 7.6.0(R2008a)
什么是错的任何建议,有什么我可以修复这个错误,或者我可以尝试从MATLAB内部调用这个.dll文件。
我改变头文件和源文件: 外部的 “C” { INT添加(INT A,INT B) { 返回(A + B); } \t void函数(无效) { \t的printf( “DLL调用\ n”); } } >>的LoadLibrary( 't1.dll', 'T1Header.h') 警告:消息从C预处理: LCC预处理器警告:C:\用户\玛赫纳兹\文件\ MATLAB \ T1Header。H:21没有换行符在 文件 >在调用LoadLibrary结束在351 警告:函数“添加”没有在435 警告库 >在调用LoadLibrary发现:该功能“功能”是不是在库中找到 和calllib函数找不到ADD方法 – mahnaz0098 2012-08-08 10:53:01