Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

VC++ linking problems

Hello, I realize this question involves other non-ni products but it involves an ni card and ni function library so I was hoping I could get some advice if anyone has any, thanks. I'm trying to make a c++ file to interface with a
hardware timed digital output NIDAQ card (PCI 6533). I made
some simple code using DIG_Trigger_Config, DIG_Grp_Config,
DIG_Block_PG_Config, and DIG_Block_Out. These are the
includes I'm using:
#include <stdio.h>
#include <nidaq.h>
#include <mex.h>

To compile it in matlab I selected vc++ as my compiler
(using: mex -setup) and type: mex blablah.cpp

and it compiles ok but at the end I get a linking error as
can be seen below. It seems that all four of the nidaq
functions I'm trying to use failed to link for some reason.
I'm not even quite sure what that means, could anyone point
me in the right direction? thanks. My full code is at the
very bottom too.

==================error messages:=============

>> mex nidaq6533test.cpp
Microsoft (R) Incremental Linker Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
 
C:\DOCUME~1\shaohua\LOCALS~1\Temp\mex_D48BFB18-A3B4-49C6-2DA0-DF2C1043A021\nidaq6533test.obj
 
   Creating library
C:\DOCUME~1\shaohua\LOCALS~1\Temp\mex_D48BFB18-A3B4-49C6-2DA0-DF2C1043A021\templib.x
and object
C:\DOCUME~1\shaohua\LOCALS~1\Temp\mex_D48BFB18-A3B4-49C6-2DA0-DF2C1043A021\templib.exp

nidaq6533test.obj : error LNK2001: unresolved external
symbol _DIG_Block_Out@16
nidaq6533test.obj : error LNK2001: unresolved external
symbol _DIG_Block_PG_Config@28
nidaq6533test.obj : error LNK2001: unresolved external
symbol _DIG_Grp_Config@20
nidaq6533test.obj : error LNK2001: unresolved external
symbol _DIG_Trigger_Config@36
nidaq6533test.mexw32 : fatal error LNK1120: 4 unresolved
externals
 
  C:\PROGRA~1\MATLAB\R2007A\BIN\MEX.PL: Error: Link of
'nidaq6533test.mexw32' failed.
 
??? Error using ==> mex at 206
Unable to complete successfully.









=============here's the code:====================

#include <stdio.h>
#include <C:\nidaq.h>
#include "mex.h"


void mexFunction(int nlhs, mxArray *plhs[], int nrhs,
mxArray *prhs[])
     {

//##########################################
//#######--print "hello world"--############
//##########################################
mexPrintf("Hello world");


//####################################
int deviceNumber = 1;
int group = 1;
//####################################

//####################################
int startTrig = 0; //(software start)
int startPol = 0; //(n/a, but 0 = high)
int stopTrig = 0; //(0 = software, 1 = hardware)
int stopPol = 0;
int ptsAfterStopTrig = 2; //(n/a)
int pattern = 0; //(n/a)
int patternMask = 0; //(n/a)

DIG_Trigger_Config (deviceNumber, group, startTrig,
startPol, stopTrig, stopPol, ptsAfterStopTrig, pattern,
patternMask);

//####################################
int groupSize = 1; //(1 port)
int port = 0; //(with group = 1 and port = 0 uses port A)
int dir = 1; //(output)

DIG_Grp_Config (deviceNumber, group, groupSize, port, dir);

//####################################
int config = 2; //(no req latching)
int reqSource = 0; //(internal counters)
int timebase = 5; //(10ms, change this later)
int reqInterval = 1000; //(2 - 65,000)
int externalGate = 0; //(no other option)

DIG_Block_PG_Config (deviceNumber, group, config, reqSource,
timebase,reqInterval, externalGate);

//####################################
short* buffer;
buffer[0] = 255;
buffer[1] = 0;
buffer[2] = 255;
buffer[3] = 0;
buffer[4] = 255;

int count = 5; //(the number of elements in the buffer)

DIG_Block_Out (deviceNumber, group, buffer, count);

//####################################
0 Kudos
Message 1 of 1
(6,315 Views)