-1

DAQ デバイスを制御するために必要なプログラムをコンパイルしようとしています。Windows では g++ のコンパイルとリンクは問題ありませんが、Linux ではそうではありません。リンカー (G++ によって呼び出される) が表示されます。

g++ -Wall -o "acelerar-30-0" "acelerar-30-0.cpp" (en el directorio: /home/poly/)
/tmp/ccRLpB4q.o: In function `main':
acelerar-30-0.cpp:(.text+0x429): undefined reference to `AdxInstantAoCtrlCreate'
collect2: ld returned 1 exit status
Ha fallado la compilación.

cpp ファイルは次のとおりです (カット):

include stdlib.h
include stdio.h
include math.h
include "compatibility.h"
include "bdaqctrl.h"
include "comunes.h"
using namespace Automation::BDaq;
define deviceDescription L"USB-4704,BID#0"
int32       channelStart = 0;
int32       channelCount = 1;
double      voltaje[0];
int32       modo;
int32       ms;
int main(int argc, char* argv[])
{
    if (argc!=3)
        salidaerror(argv[0],1);
    channelStart = atoi(argv[1]);
    ms = atoi(argv[2]);
    if (channelStart<0||channelStart>1||ms<10)
        salidaerror(argv[0],1);
    ErrorCode ret = Success;
    InstantAoCtrl * instantAoCtrl = AdxInstantAoCtrlCreate();
...

私はこれに数時間費やしましたが、答えが見つかりません。SDK は Debian/Ubuntu 用で、Linux と Windows 用の同じコードがあります。

ヒントはありますか?ありがとう

編集:フォーマットが正しくないため、いくつかのマークを削除しました

4

1 に答える 1

1

私の(限られた)経験では、典型的なgccの動作では、次のようにコマンドラインで引数としてその関数を含むライブラリを指定する必要があります。

-lsome_library

これは、ライブラリがライブラリパスにある場合でも必要です(追加のライブラリパスは-Lで指定できます)。その関数を含む適切なライブラリファイルを見つけ、そのファイル名から拡張子を引いたものと、上記の引数形式の先頭の「lib」を使用します。

于 2013-02-01T01:39:15.820 に答える