08-22-2006 08:48 PM
uInt32 ProductNum,ProductCat;
DAQmxGetDevProductNum("Dev1",&ProductNum);
DAQmxGetDevProductCategory("Dev1",&ProductCat);
but there are errors from the compiler that
error C3861: 'DAQmxGetDevProductNum': identifier not founderror C3861: 'DAQmxGetDevProductCategory': identifier not found
08-24-2006 11:22 AM
Hi David,
You have to include NiDAQmx.lib in C++ environment. For complete list of settings, please refer to this knowledge base:
http://digital.ni.com/public.nsf/websearch/0087C1E20920F7B986256D9B0061DEE2?OpenDocument
Please let me know if this helps.
Thanks,
Kalyan
08-24-2006 07:52 PM
Hi, Kalyan,
I have already included both NiDAQmx.lib and NiDAQmx.h in my project by right-clicking on the source files, and selecting Add» Add Existing Item. The problem still exists. Is it the correct way to add the library files?
Thanks.
David
08-27-2006 10:12 PM
08-28-2006 12:13 AM
08-28-2006 04:25 PM
Hi David,
These are the steps I would follow to fix your code:
Click the Directories tab. Make sure you are viewing the directories for include files, and add the following new path: C:\Program Files\National Instruments\NI-DAQ\DAQmx ANSI C Dev\include.
Add a link for library files with the following path: C:\Program Files\National Instruments\NI-DAQ\DAQmx ANSI C Dev\lib\msvc.
After you add NIDAQmx.lib and NIDAQmx.h, the code should compile without problems.
Thanks,
08-28-2006 04:28 PM
Hi David,
Forgot to mention that attached zip file has example code which I created to show you as how to get the list of devices in a computer using VC++ and DAQmx.
Thanks,
Kalyan
08-28-2006 08:10 PM
08-28-2006 08:27 PM
Hi, Kalyan,
In some posts it was said that DAQmxGetSystemInfoAttribute and DAQmxGetDeviceAttribute is for CVI only. And in DAQmx C, I have to use DAQmxGetDevProductType and DAQmxGetDevSerialNum. If it is true, would you please provide any code with DAQmx C, not CVI, to enumerating devices?
Thank you very much!
David
08-29-2006 11:20 AM
Hi David,
Sorry for the confusion. What I was referring to is:
Add the following files to your project;
1) C:\Program Files\National Instruments\NI-DAQ\DAQmx ANSI C Dev\lib\msvc\NIDAQmx.lib
2) C:\Program Files\National Instruments\NI-DAQ\DAQmx ANSI C Dev\include\NIDAQmx.h
If you don't add the library file, you will get the linking errors. Please refer to the sample project I posted as how the following files have been added to project.
In the code I have posted for VC++, I used DAQmxGetSystemInfoAttribute for getting the list of devices. Then I poupulated the properties of each device using DAQmxGetDevProductType and DAQmxGetDevSerialNum.
The code I posted should answer most of the questions.
Thanks,
Kalyan