eclipse - NI-VISA library programming in C++ - out of scope error -
i trying program rigol ds1054 oscilloscope output waveform data. create program, writing in c++ using code::blocks, have tried on 4 other compilers (netbeans, eclipse mars, eclipse juno, visual basic 2012) each 1 continuously results in error. here have done far:
- confirmed c++ not problem building , running hello world program
- linked header file following path (c:\program files (x86)\ivi foundation\visa\winnt\include)
- linked library using path (c:\program files (x86)\ivi foundation\visa\winnt\lib\msc\visa32.lib)
- applied library each project
i have tried using 64-bit version same error. current code:
#include <iostream> #include <visa.h> using namespace std; int main () { visession rmsession; viopendefaultrm(&rmsession); return 0; } the code simple, when run, returns error:
error: 'viopendefaultrm' not declared in scope this weird since in scope. has been giving me trouble many days - appreciated. thank you!
the function called viopendefaultrm, not viopendefaultrm.
for avoidance of confusion such errors in future, viopendefaultrm(&rmsession) in code not declaration of function, invocation or call of function (or be, if such function existed).
in c++, compiler must see declaration of function before permit invocations of function, can tell whether invocation conforms function's signature (or 1 of signatures of overloaded function), , declaration must still in scope @ point of invocation.
the declaration of viopendefaultrm is:
vistatus _vi_func viopendefaultrm (vipsession vi); you find in visa.h, , in scope @ point have attempted call viopendefaultrm because, including visa.h before define main, declared in scope enclosing main, i.e. in global scope.
Comments
Post a Comment