NI製品ディスカッション

キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

GPIBプログラミングについて

PCから御社製 PCMCIA-GPIBカード(777438-02)を介してHP製 可変アッテネーターを制御するソフトを開発しています。
開発環境はVisual Studio .NET VC++です。
以下のようなエラーメッセージを解決できず、困っています。
解決策を教えて頂きたく、よろしくお願いします。
 
GPIB_TEST error LNK2001: 外部シンボル ""int __stdcall ibonl(int,int)" (?ibonl@@$$J18YGHHH@Z)" は未解決です。
GPIB_TEST error LNK2001: 外部シンボル ""int __stdcall ibrd(int,void *,long)" (?ibrd@@$$J212YGHHPAXJ@Z)" は未解決です。
GPIB_TEST error LNK2001: 外部シンボル ""int __stdcall ibwrt(int,void *,long)" (?ibwrt@@$$J212YGHHPAXJ@Z)" は未解決です。
GPIB_TEST error LNK2001: 外部シンボル ""int __stdcall ibdev(int,int,int,int,int,int)" (?ibdev@@$$J224YGHHHHHHH@Z)" は未解決です。
GPIB_TEST fatal error LNK1120: 外部参照 4 が未解決です。
ソースは以下のとおりです。
 
#include "stdafx.h"
#include <windows.h>
#include "ni488.h"
#include <stdio.h>
#using <mscorlib.dll>
using namespace System;
/*****************************************************************************
 * Refer to the language interface documentation for details on
 * which header and .obj files to include in your project.
 *****************************************************************************/
int Device = 0;                   /* Device unit descriptor                  */
int BoardIndex = 0;               /* Interface Index (GPIB0=0,GPIB1=1,etc.)  */
 
int _tmain()
{
   int   PrimaryAddress = 2;      /* Primary address of the device           */
   int   SecondaryAddress = 0;    /* Secondary address of the device         */
   char  Buffer[101];             /* Read buffer                             */
/*****************************************************************************
 * Initialization - Done only once at the beginning of your application.
 *****************************************************************************/
   Device = ibdev(                /* Create a unit descriptor handle         */
         BoardIndex,              /* Board Index (GPIB0 = 0, GPIB1 = 1, ...) */
         PrimaryAddress,          /* Device primary address                  */
         SecondaryAddress,        /* Device secondary address                */
         T10s,                    /* Timeout setting (T10s = 10 seconds)     */
         1,                       /* Assert EOI line at end of write         */
         0);                      /* EOS termination mode                    */
/*****************************************************************************
 * Main Application Body - Write the majority of your GPIB code here.
 *****************************************************************************/
   ibwrt(Device, "*IDN?", 5);     /* Send the identification query command   */
   ibrd(Device, Buffer, 100);     /* Read up to 100 bytes from the device    */
 
 
/*****************************************************************************
 * Uninitialization - Done only once at the end of your application.
 *****************************************************************************/
   ibonl(Device, 0);              /* Take the device offline                 */
}

 
0 件の賞賛
メッセージ1/2
4,336件の閲覧回数
yukizaki 様
 
ディスカッションフォーラムへの投稿有難うございます。
日本ナショナルインスツルメンツ技術部大平と申します。
 
このエラーはリンクエラーであり、リンカがibonl, ibrd, ibwrt, ibdevなどのコマンドの定義を見つけることができなかった際に発生します。
GPIB通信を行う際には、「ni488.h」と「gpib-32.obj」がインターフェースファイルとして必要になりますので、「gpib-32.obj」ファイルをプロジェクトに追加することにより、エラーが解決されると思われます。以下にファイルの追加方法を記載いたしますので是非ご参照ください。
 
1. 「gpib-32.obj」ファイルのディレクトリを確認します。
(デフォルトでは、C:\Program Files\National Instruments\NI-488.2\Languages\Microsoft C\gpib-32.obj です。)
2. メニューバーからプロジェクト→プロジェクトへ追加→ファイルを選択し、「gpib-32.obj」を追加します。
(ファイルを選択する際に、ファイルの種類を「すべてのファイル」に変更します。)
 
また、テキスト言語でのGPIB通信に関しまして以下にURLを添付致しましたので、こちらも是非ご参照していただければと思っております。
http://digital.ni.com/worldwide/japan.nsf/web/all/809e6401187f3a17492570600007b338
 
上記内容に関しましてご不明な点等ございましたらお気軽にご連絡お願いいたします。
宜しくお願い申し上げます。
 
日本ナショナルインスツルメンツ
技術部 大平 悠生
0 件の賞賛
メッセージ2/2
4,290件の閲覧回数