1

以下のコードをコンパイルしようとしています:

#include <cstdlib>
#define HAVE_STRUCT_TIMESPEC
#include <mgl2/mgl.h>
using namespace std;

int main() {
   mglGraph gr;
   gr.FPlot("sin(pi*x)");
   gr.WriteFrame("test.png");
   return 0;
}

私はNetbeans IDE、Win 10 64xを使用しています....しかし、このエラーが発生し続けます:

あなたの助けに感謝。

cd 'C:\Users\SAQERpc\Documents\NetBeansProjects\Plotting' C:\MinGW\msys\1.0\bin\make.exe -f Makefile CONF=Debug "/C/MinGW/msys/1.0/bin/make.exe " -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf make.exe[1]: Entering directory /c/Users/SAQERpc/Documents/NetBeansProjects/Plotting' "/C/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/plotting.exe make.exe[2]: Entering directory/c/Users/SAQERpc/Documents/NetBeansProjects/Plotting' mkdir -p build/Debug/MinGW-Windows rm -f "ビルド/デバッグ/MinGW-Windows/main.od" g++ -c -g -MMD -MP -MF "ビルド/デバッグ/MinGW-Windows/main.od" -o ビルド/デバッグ/MinGW-Windows/ main.o main.cpp mkdir -p dist/Debug/MinGW-Windows g++ -o dist/Debug/MinGW-Windows/plotting build/Debug/MinGW-Windows/main.o -lmgl build/Debug/MinGW-Windows/main .o: 関数ZN8mglGraphC1Eiii': c:/mingw/include/mgl2/mgl.h:39: undefined reference to_imp___ZTV8mglGraph' 内 c:/mingw/include/mgl2/mgl.h:42: _imp__mgl_create_graph_gl' c:/mingw/include/mgl2/mgl.h:48: undefined reference to_imp__mgl_create_graph'への未定義の参照build/Debug/MinGW-Windows/main.o: 関数内ZN8mglGraphD1Ev': c:/mingw/include/mgl2/mgl.h:53: undefined reference to_imp___ZTV8mglGraph' c:/mingw/include/mgl2/mgl.h:53: _imp__mgl_delete_graph への未定義の参照_imp__mgl_use_graph' c:/mingw/include/mgl2/mgl.h:53: undefined reference to' build/Debug/MinGW-Windows/main.o: 関数ZN8mglGraph11SetFontSizeEd': c:/mingw/include/mgl2/mgl.h:122: undefined reference to内 _imp__mgl_set_font_size' build/Debug/MinGW-Windows/main.o:関数ZN8mglGraph10WriteFrameEPKcS1_': c:/mingw/include/mgl2/mgl.h:399: undefined reference to_imp__mgl_write_frame' build/Debug/MinGW-Windows/main.o: 関数ZN8mglGraph5FPlotEPKcS1_S1_': c:/mingw/include/mgl2/mgl.h:1973: undefined reference to_imp__mgl_fplot' collect2.exe: エラー: ld が 1 終了ステータスを返しました make.exe[2]: * [dist/Debug/MinGW-Windows/plotting. exe] エラー 1 make.exe[2]: ディレクトリ/c/Users/SAQERpc/Documents/NetBeansProjects/Plotting' make.exe[1]: *** [.build-conf] Error 2 make.exe[1]: Leaving directory/c/Users/SAQERpc/Documents/NetBeansProjects/Plotting' make.exe を離れています": * [.build-impl] エラー 2

BUILD FAILED (終了値 2、合計時間: 2 秒)

4

2 に答える 2

0

これも試してみてください

Open your project properties
Click "Linker" in the left pane
Find "Libraries" line and click button with "..." on its right side
Click "Add option..." in the right pane
Select "Other Option" and type "-lodbc"
Click "Ok"
Rebuild your project
于 2018-12-29T08:00:57.390 に答える