0
我試圖將一些簽證代碼加入我的mex文件,但無法弄清楚爲什麼這些功能沒有解決。代碼和matlab輸出如下所示。有人提示我做錯了什麼嗎? 歡呼Mex Link visa32.lib
EAC
的SourceFile:
#include "mex.h"
#include <stdio.h> /* For printf(). */
#include <string.h> /* For strcpy(), strcat(). */
#include <time.h> /* For clock(). */
#include "visa.h" /* Agilent VISA routines. */
#define VISA_ADDRESS "USB0::0x0957::0x17A6::MY51136169::0::INSTR"
#define IEEEBLOCK_SPACE 5000000
ViSession defaultRM, vi;
void do_command(char *command); /* Send command. */
void mexFunction(int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[]) {
do_command("*RST");
}
void do_command(command)
char *command;
{
char message[80];
strcpy(message, command);
strcat(message, "\n");
viPrintf(vi, message);
}
Matlab的輸出:
>> mex HelloWorld.c -Lvisa32.lib
Writing library for HelloWorld.mexw32
c:\users\pehrlich\appdata\local\temp\mex_c04c6da5-c5ef-49d8-a8aa-c5107c66b1fa\helloworld.obj .text: undefined reference to '_viPrintf'
D:\MATLAB\R2006B\BIN\MEX.PL: Error: Link of 'HelloWorld.mexw32' failed.
??? Error using ==> mex
Unable to complete successfully.
沒有幫助。不,它告訴我它不能找到visa32.lib,儘管它和HelloWorld.c在同一個文件夾中 – eactor 2011-12-23 07:18:24
嘗試'mex HelloWorld.c -lvisa32'(不帶'.lib'),帶或不帶' -L.'。 – user1071136 2011-12-23 10:17:39
mex HelloWorld.c -LD:\ -lvisa32 爲HelloWorld.mexw32編寫庫 c:\ users \ pehrlich \ appdata \ local \ temp \ mex_e69e23c0-0d75-4454-2c87-5e9589f051db \ helloworld.obj .text:undefined reference到'_viPrintf' D:\ MATLAB \ R2006B \ BIN \ MEX.PL:錯誤:'HelloWorld.mexw32'的鏈接失敗。 ???錯誤使用==> mex 無法成功完成。 – eactor 2012-03-08 09:38:22