• 締切済み

CygwinとGrwinが使えない

Cygwinは正常にインストールされています(と思います)。 その後Grwinをインストールしたのですがデモプログラムなどをコンパイルしようとするとエラーが出てしまいます。 #include <GrWin.h> main(){ GWinit(); GWopen(0); GWindow(-1,-1,1,1); GWline(-1,-1,1,1); } 上のようなプログラムをコンパイルしようとすると、 /tmp/cceporaS.o:test2.c:(.text+0x40): undefined reference to `_***' というエラーが出てしまいます。***の部分は上で使った関数(GWinitなど)です。 確認したことは C:\cygwin\usr\includeにGrWin.hがあること。 C:\cygwin\libにlibCalcomp.a、libGrWin.a、libGrWin0.a、libcpgplot.a、libpgplot.aがあること。 コンパイルの方法はcc test.c -o testです。 これ以上どうすればいいか分かりません。アドバイスお願いします。

みんなの回答

  • jacta
  • ベストアンサー率26% (845/3158)
回答No.1

GrWin自体は使ったことがないので推測の域を出ませんが... > C:\cygwin\libにlibCalcomp.a、libGrWin.a、libGrWin0.a、libcpgplot.a、libpgplot.aがあること。 -lGrWin等のオプションは付けていますか?

MOOORY
質問者

補足

>-lGrWin等のオプションは付けていますか? オプションとは何でしょうか?

関連するQ&A

  • cygwinのgccが、エラーになってしまいます。

    テストプログラム $ cat test.c #include <stdio.h> int main (void) { printf("Hello, World!\n"); return 0; } これを、コンパイルすると $ gcc test.c gcc: error trying to exec '/usr/lib/gcc/i686-pc-cygwin/4.5.3/cc1.exe': execv: Bad address /usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../libcygwin.a(libcmain.o):(.text+0xba): undefined reference to `_WinMain@16' collect2: ld はステータス 1 で終了しました と、このようなエラーが出てきました。 ファイルを確認しても、何も作られていません。 $ ls test.c 対処方法を、ご教示願います。

  • cygwin gcc c99 での isnormal と strtold の使用

    Cygwinのgccで-std=c99オプションを付けて 以下のコードをコンパイルしようとしています。 #include <stdlib.h> #include <math.h> int main() { isnormal(0.123); strtold("0.123", NULL); return 0 ; } $> gcc -std=c99 test_strtold.c ですが、コンパイルできず、2つの関数とも'undefined reference'になります。 -std=c99を付けてコンパイルする方法または この記述と同等の別の記述がありましたらご教授願います。 よろしくお願いいたします。

  • Cygwinでの自作ヘッダファイルの使用方法

    Cygwinでソースをコンパイルすると cygdrive/c/DOCUME~1/user/..../cc5uZTak.o:submain.c: undefined reference to 'parameter' と言うエラーが出ます。 ヘッダファイルも宣言しているのですが...コンパイルが通りません ヘッダファイルの位置が行けないのでしょうか?

  • Windowsコモンコントロールのcygwin/gccコンパイルエラー

    以下のサイトのようなWindowsコモンコントロールのプログラムをcygwin/gccコンパイルするとエラーがでます。 (sourceのサイト) http://wisdom.sakura.ne.jp/system/winapi/common/common16.html (ビルドコマンド) gcc -mwindows -mno-cygwin -o main.exe main.cpp (エラー出力) undefined reference to `_ImageList_Destroy@4' undefined reference to `_InitCommonControls@0' undefined reference to `_ImageList_Create@20' undefined reference to `_ImageList_ReplaceIcon@12' undefined reference to `_ImageList_ReplaceIcon@12' collect2: ld returned 1 exit status make: *** [main.exe] Error 1 Windowsコモンコントロールを含んだプログラムをcygwin/gccコンパイルするにはどうすればよいでしょうか? コンパイルは出来ないのでしょうか? よろしくお願いします。

  • cygwin環境

    C言語にて作成したプログラムをcygwin環境にて(gcc)コンパイルすると "c:\DOCUME~1\ユーザ名\LOCALS~1\Temp/ccy2baaa.o:sl.c:(.text+0x4f):undefined reference to __imp__(func名)@16 collect2:ld returned 1 exit status" のようなエラーが発生してしまいます。 解決法は無いでしょうか??

  • PostgreSQLをC言語でアクセスしようと

    PostgreSQL 8.4.8 文書にのっているサンプルプログラムの 例 30-1. libpq サンプルプログラム 1 #include <stdio.h> #include <stdlib.h> #include "libpq-fe.h" ・・・・・・・・・・・・・ をコピペしてコンパイルしたところ次のようなエラーがでました # gcc sample.c /tmp/cctZBolQ.o: In function `exit_nicely': sample.c:(.text+0xd): undefined reference to `PQfinish' /tmp/cctZBolQ.o: In function `main': sample.c:(.text+0x4a): undefined reference to `PQconnectdb' sample.c:(.text+0x5a): undefined reference to `PQstatus' sample.c:(.text+0x6a): undefined reference to `PQerrorMessage' sample.c:(.text+0xa5): undefined reference to `PQexec' sample.c:(.text+0xb5): undefined reference to `PQresultStatus' sample.c:(.text+0xc6): undefined reference to `PQerrorMessage' sample.c:(.text+0xed): undefined reference to `PQclear' sample.c:(.text+0x105): undefined reference to `PQclear' sample.c:(.text+0x119): undefined reference to `PQexec' sample.c:(.text+0x129): undefined reference to `PQresultStatus' sample.c:(.text+0x13a): undefined reference to `PQerrorMessage' sample.c:(.text+0x161): undefined reference to `PQclear' sample.c:(.text+0x179): undefined reference to `PQclear' sample.c:(.text+0x18d): undefined reference to `PQexec' sample.c:(.text+0x19d): undefined reference to `PQresultStatus' sample.c:(.text+0x1ae): undefined reference to `PQerrorMessage' sample.c:(.text+0x1d5): undefined reference to `PQclear' sample.c:(.text+0x1ed): undefined reference to `PQnfields' sample.c:(.text+0x20f): undefined reference to `PQfname' sample.c:(.text+0x26b): undefined reference to `PQgetvalue' sample.c:(.text+0x2a8): undefined reference to `PQntuples' sample.c:(.text+0x2ba): undefined reference to `PQclear' sample.c:(.text+0x2ce): undefined reference to `PQexec' sample.c:(.text+0x2de): undefined reference to `PQclear' sample.c:(.text+0x2f2): undefined reference to `PQexec' sample.c:(.text+0x302): undefined reference to `PQclear' sample.c:(.text+0x30e): undefined reference to `PQfinish' collect2: ld はステータス 1 で終了しました # # find /usr/include/ -name libpq*.h /usr/include/pgsql/internal/libpq-int.h /usr/include/pgsql/server/libpq/libpq-be.h /usr/include/pgsql/server/libpq/libpq.h /usr/include/pgsql/server/libpq/libpq-fs.h /usr/include/libpq/libpq-fs.h /usr/include/libpq-events.h /usr/include/libpq-fe.h # gcc -I/usr/include sample.c でもおなじです どうすればコンパイル出きるようになるでしょうか? よろしくお願いします

  • cygwinでのエラーについて

    cygwinでコンパイルしようとしたところ次のようなエラーが表示されました。 undefined reference to '_imp_iob' collect2: ld returned 1 exit status どのような意味なのでしょうか?対処法なども教えてください。

  • C言語コンパイラーエラーについて教えてください。

    C言語でコンパイルができなくて困っています。 コンパイルをすると、 ----------------------------------------- test.c.20:undefined reference to `getcury' test.c:20: undefined reference to `getcurx' collect2: ld returned 1 exit status ----------------------------------------- と言うエラーが出てしまい、コンパイルが完了しません。 ソースは、「test.c」と言うファイルネームで、内容は ----------------------------------------- #include <stdio.h> #include <stdlib.h> #include <curses.h> int main (void) { int y = 0, x = 0; initscr(); getyx(curscr, y, x); printw("x = %d, y = %d", x, y); refresh(); getchar(); endwin(); return 0; } ----------------------------------------- です。 OSは、Windows7 Professional SP1 コンパイラーは、MinGW Ver5.1.6. で、コマンドは gcc -o test.exe test.c -lcurses です。 確かに、curses へはパスも通っており、リンクできているようなんですが、 エラーが出てしまいます。 どうすれば良いのかわからず、大変困っています。 だれかご存知の方、教えてください。 どうかよろしくお願い致します。

  • コンパイル時のエラー

    UNIXでサーバー、クライアントのCプログラミングをテキストどおりに書いてコンパイルしたのですが、以下のエラーが出ます。gcc, ccでコンパイルすると以下のようになるのですが、これはどういうことなのでしょうか?何が原因なのでしょうか?よろしくお願いいたします。 gcc unix_server.c /var/tmp/ccvpay1f1.o: In function `main': /var/tmp/ccvpay1f1.o(.text+0x8c): undefined reference to `socket' /var/tmp/ccvpay1f1.o(.text+0x104): undefined reference to `unllnk' /var/tmp/ccvpay1f1.o(.text+0x118): undefined reference to `bind' /var/tmp/ccvpay1f1.o(.text+0x150): undefined reference to `listen' /var/tmp/ccvpay1f1.o(.text+0x1a8): undefined reference to `accept' cc unix_server.c ld: /usr/lib/cmplrs/cc/crtn.o: Error: Unresolved: rindex socket bzero bcopy unllnk bind listen accept

  • cygwin gccでの_WinMain@16

    WinXP SP2上でcygwinを用いてプログラミングをしています。 QNo.580169 にもあったのですが、undefined reference to `_WinMain@16` で困っています。 二つのソースファイルをそれぞれコンパイルして、それをリンクさせて実行ファイルを作ろうと思っているのですが、main関数が書かれていないソースファイルをコンパイルしようとすると上のメッセージが出ます。どのようにして回避できるでしょうか。 教えてください。

専門家に質問してみよう