libSDL.aをリンクしたのに参照が見つからない

このQ&Aのポイント
  • g++コマンドでlibSDL.aをリンクしたにもかかわらず、参照が見つかりません。
  • エラーメッセージには、undefined reference to `_SDL_Delay'という参照エラーが表示されています。
  • myapp.ccの29行目にある`SDL_Delay`の呼び出しに関連したエラーが発生しているようです。
回答を見る
  • ベストアンサー

libSDL.aをリンクしたのに参照が見つからない

以下makeの出力です. g++ -c -g -Wall --std=c++11 -O3 `sdl-config --cflags` main.cc g++ -c -g -Wall --std=c++11 -O3 `sdl-config --cflags` myapp.cc make -C ./util make[1]: Entering directory `/home/****/####/src/util' g++ -c -g -Wall --std=c++11 -O3 rand.cc g++ -c -g -Wall --std=c++11 -O3 color.cc ar r libutil.a rand.o color.o C:\MinGW\bin\ar.exe: creating libutil.a ranlib libutil.a make[1]: Leaving directory `/home/****/####/src/util' g++ -g -Wall --std=c++11 -O3 `sdl-config --cflags` `sdl-config --libs` ./util/l ibutil.a main.o myapp.o -o ####.exe myapp.o: In function `_ZN5MyApp4execEv': C:\MinGW\msys\1.0\home\****\####\src/myapp.cc:29: undefined reference to `_SDL_ Delay' C:\MinGW\msys\1.0\home\****\####\src/myapp.cc:29: undefined reference to `_SDL_ Delay' C:\MinGW\msys\1.0\home\****\####\src/myapp.cc:29: undefined reference to `_SDL_ Delay' C:\MinGW\msys\1.0\home\****\####\src/myapp.cc:29: undefined reference to `_SDL_ Delay' C:\MinGW\msys\1.0\home\****\####\src/myapp.cc:29: undefined reference to `_SDL_ Delay' myapp.o:C:\MinGW\msys\1.0\home\****\####\src/myapp.cc:29: more undefined refere nces to `_SDL_Delay' follow collect2.exe: エラー: ld はステータス 1 で終了しました make: *** [charaga.exe] Error 1 エラーのあるmyapp.ccです. #include <iostream> #include <SDL.h> #include "myapp.h" using ::std::cout; using ::std::endl; struct MyApp::Impl{ Impl(int argc, char *argv[]) { SDL_Init(SDL_INIT_TIMER); } ~Impl() { SDL_Quit(); } }; void ::MyApp::init(int argc, char *argv[]) { impl.reset(new Impl(argc, argv)); } void ::MyApp::exec() { for(int i = 0; i < 6; i++){ cout << i << "sec." << endl; SDL_Delay(1000); } } nm libSDL.aからの抜き出しです. SDL_audio.o: 000002b4 T _SDL_CloseAudio U _SDL_ConvertAudio U _SDL_CreateMutex U _SDL_CreateThread U _SDL_Delay U _SDL_DestroyMutex U _SDL_Error SDL_events.o: 00000000 t .text U _SDL_AppActiveInit U _SDL_AppActiveQuit U _SDL_CheckKeyRepeat U _SDL_CreateMutex U _SDL_CreateThread U _SDL_Delay U _SDL_DestroyMutex SDL_diskaudio.o: 00000000 D _DISKAUD_bootstrap U _SDL_Delay U _SDL_Error U _SDL_RWFromFile U _SDL_getenv U ___mingw_vfprintf U __imp___iob U _atoi SDL_dummyaudio.o: 00000000 D _DUMMYAUD_bootstrap U _SDL_Delay U _SDL_Error U _SDL_getenv U _free U _malloc SDL_dibaudio.o: 0000057c t _FillSound@20 U _GetCurrentThread@0 U _ReleaseSemaphore@12 U _SDL_CalculateAudioSpec U _SDL_Delay U _SDL_Error U _SDL_SetError SDL_systimer.o: 000000a4 T _SDL_Delay $ sdl-config --cflags --libs -I/mingw/include/SDL -D_GNU_SOURCE=1 -Dmain=SDL_main -L/mingw/lib -lmingw32 -lSDLmain -lSDL -mwindows ご指南の方よろしくお願いします.

質問者が選んだベストアンサー

  • ベストアンサー
  • wormhole
  • ベストアンサー率28% (1621/5656)
回答No.1

>g++ -g -Wall --std=c++11 -O3 `sdl-config --cflags` `sdl-config --libs` ./util/libutil.a main.o myapp.o -o ####.exe が下記のようになるようにMakefileを書き換えてみてください。 g++ -g -Wall --std=c++11 -O3 `sdl-config --cflags` ./util/libutil.a main.o myapp.o -o ####.exe `sdl-config --libs`

aryuanother
質問者

お礼

素早い回答ありがとうございます. 何故かはわかりませんが解決しました.

関連するQ&A

  • g95プログラムからg++関数を呼び出したい。

    g95プログラムからg++関数を呼び出したい。 いつもお世話になっています。 Fortran(g95)プログラムからg++関数を呼び出したいのですが、 実行できません。 どのようにすればよいか、教えて頂けませんでしょうか。 (ちなみにg77からC++を呼ぶことはできました。) ===環境設定=== OS:WindowsXP(pro) C++コンパイラ :MinGW g++ (gcc version 3.4.5) Fortranコンパイラ:MinGW g95 (gcc version 4.1.2) Fortranコンパイラ:MinGW g77 (gcc version 3.4.5) ===使用したソース=== <Fortran> ファイル名:f.f    write(*,*) "Hello Fortran World."    call funchelloc()    end ※実際には、各行先頭に半角スペース6個が入ります。 <C++> ファイル名:funcC.cpp #include <stdio.h> #include <iostream> int main(void) {   printf("hello C world!\n");   return 0; } ※見やすくするため、全角スペースでインデントしています。 ===実行手順=== >g++ -c funcC.cpp >g95 -c f.f >g95 f.o funcC.o -lstdc++ c:/mingw/lib///libstdc++.a(eh_throw.o):eh_throw.cc:(.text+0x7b): undefined reference to `_ _w32_sharedptr_unexpected' c:/mingw/lib///libstdc++.a(eh_throw.o):eh_throw.cc:(.text+0x8c): undefined reference to `_ _w32_sharedptr_terminate' c:/mingw/lib///libstdc++.a(eh_globals.o):eh_globals.cc:(.text+0x4e): undefined reference t o `__w32_sharedptr' c:/mingw/lib///libstdc++.a(eh_globals.o):eh_globals.cc:(.text+0xb9): undefined reference t o `__w32_sharedptr' c:/mingw/lib///libstdc++.a(eh_globals.o):eh_globals.cc:(.text+0x179): undefined reference to `__w32_sharedptr' c:/mingw/lib///libstdc++.a(eh_globals.o):eh_globals.cc:(.text+0x186): undefined reference to `__w32_sharedptr' c:/mingw/lib///libstdc++.a(eh_globals.o):eh_globals.cc:(.text+0x1e3): undefined reference to `__w32_sharedptr' c:/mingw/lib///libstdc++.a(eh_globals.o):eh_globals.cc:(.text+0x1ef): more undefined refer ences to `__w32_sharedptr' follow c:/mingw/lib///libstdc++.a(eh_terminate.o):eh_terminate.cc:(.text+0x67): undefined referen ce to `__w32_sharedptr_terminate' c:/mingw/lib///libstdc++.a(eh_terminate.o):eh_terminate.cc:(.text+0x97): undefined referen ce to `__w32_sharedptr_unexpected' c:/mingw/lib///libstdc++.a(eh_terminate.o):eh_terminate.cc:(.text+0xb3): undefined referen ce to `__w32_sharedptr_terminate' c:/mingw/lib///libstdc++.a(eh_terminate.o):eh_terminate.cc:(.text

  • bccは分かりましたがgccが使えません

    Cのソースの#include <stdio.h>でエラーになります。 gccではbccのbcc32.cfgで行うような設定はどのようにすればよいですか? MINGWのコンソールで $ echo $C_INCLUDE_PATH c:/msys/1.0/mingw/include;c:/msys/1.0/mingw/lib/gcc/mingw32/3.4.5/include このように出ます。 $ gcc myapp.c で#include <stdio.h>の行でコンパイルエラーです。 MINGWでは$C_INCLUDE_PATHを正しく設定できているみたいですが、gcc.exeにそれが伝わっていないみたいです。 AUTOEXEC.BATには何も追記したくないので何も追記していません。 どうすればライブラリのパスを通せますか?

  • NTLのtools.hのエラーが直りません

    他のモジュールに組み込むときにはでてこないのですが、ソケット通信の関数に巨大整数を使おうすると次のようなエラーが出てきてコンパイルできません。 > すべての出力が最新のものです。 1> ClientSocketDlg.cpp 1>C:\MinGW\msys\1.0\home\admin\c\ntl-5.5.2\include\NTL/tools.h(151): error C2062: 型 'int' は不要です。 1>C:\MinGW\msys\1.0\home\admin\c\ntl-5.5.2\include\NTL/tools.h(151): error C2062: 型 'int' は不要です。 1>C:\MinGW\msys\1.0\home\admin\c\ntl-5.5.2\include\NTL/tools.h(151): error C2059: 構文エラー : ')' 1>C:\MinGW\msys\1.0\home\admin\c\ntl-5.5.2\include\NTL/tools.h(151): error C2143: 構文エラー : ';' が '{' の前にありません。 1>C:\MinGW\msys\1.0\home\admin\c\ntl-5.5.2\include\NTL/tools.h(151): error C2447: '{' : 対応する関数ヘッダーがありません (旧形式の仮引数リスト?) 1>C:\MinGW\msys\1.0\home\admin\c\ntl-5.5.2\include\NTL/tools.h(152): error C2062: 型 'int' は不要です。 1>C:\MinGW\msys\1.0\home\admin\c\ntl-5.5.2\include\NTL/tools.h(152): error C2062: 型 'int' は不要です。 1>C:\MinGW\msys\1.0\home\admin\c\ntl-5.5.2\include\NTL/tools.h(152): error C2059: 構文エラー : ')' 1>C:\MinGW\msys\1.0\home\admin\c\ntl-5.5.2\include\NTL/tools.h(152): error C2143: 構文エラー : ';' が '{' の前にありません。 1>C:\MinGW\msys\1.0\home\admin\c\ntl-5.5.2\include\NTL/tools.h(152): error C2447: '{' : 対応する関数ヘッダーがありません (旧形式の仮引数リスト?) 1>C:\MinGW\msys\1.0\home\admin\c\ntl-5.5.2\include\NTL/tools.h(154): error C2062: 型 'long' は不要です。 ・・・ NTLというのは巨大整数ライブラリです。 プログラムの先頭に、巨大整数型ZZを用いるために、 #include <NTL/ZZ.h> というヘッダを付けます。これでエラーはなくなるはずなのですが、ZZ.hの中で呼び出されているtools.hがエラーを起こします。 なにかいい解決法があったら教えて下さい。 ちなみに開発環境はMFCです。 よろしくお願いします。

  • Cppunitのビルドエラー解消

    お世話になります。 Cppunitでテストケースを作成し、ビルドしようとしておりますが、ビルドをすることができません。 ・以下がエラーログの抜粋ですが、「TestRunnerClient.o:TestRunnerClient.cpp:~」の行がEclipse上で赤く表示されており、原因だと思われます。基本的な質問で恐縮ですが、エラーの解消方法をご存知の方がおられればご教示頂けると助かります。 ・プロジェクトのライブラリ指定は添付の画像のようにしております。この部分の指定に誤りはございませんでしょうか。 d000000.o:(.idata$2+0x0): multiple definition of `_head_libcppunit_1_12_1_dll' C:\MinGW\msys\1.0\cppunit-1.12.1\src\cppunit\.libs/libcppunit.dll.a(d000387.o):(.idata$2+0x0): first defined here d000001.o:(.idata$5+0x0): multiple definition of `_imp___ZTVN7CppUnit27TestSuiteBuilderContextBaseE' C:\MinGW\msys\1.0\cppunit-1.12.1\src\cppunit\.libs/libcppunit.dll.a(d001116.o):(.idata$5+0x0): first defined here d000001.o:(.idata$6+0x0): multiple definition of `_nm___ZTVN7CppUnit27TestSuiteBuilderContextBaseE' C:\MinGW\msys\1.0\cppunit-1.12.1\src\cppunit\.libs/libcppunit.dll.a(d001116.o):(.idata$6+0x0): first defined here d000002.o:(.idata$7+0x0): multiple definition of `libcppunit_1_12_1_dll_iname' C:\MinGW\msys\1.0\cppunit-1.12.1\src\cppunit\.libs/libcppunit.dll.a(d001147.o):(.idata$7+0x0): first defined here TestRunnerClient.o:TestRunnerClient.cpp:(.text+0x34f): undefined reference to `send@16' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0x375): undefined reference to `send@16' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0x54f): undefined reference to `send@16' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0x575): undefined reference to `send@16' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0x99d): undefined reference to `gethostname@8' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0x9e8): undefined reference to `gethostname@8' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0xa4b): undefined reference to `WSAStartup@8' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0xa7f): undefined reference to `socket@12' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0xa9b): undefined reference to `gethostbyname@4' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0xae8): undefined reference to `htons@4' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0xb3b): undefined reference to `connect@12' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0xbac): undefined reference to `select@20' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0x121e): undefined reference to `closesocket@4' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0x1226): undefined reference to `WSACleanup@0' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0x138e): undefined reference to `send@16' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0x13b4): undefined reference to `send@16' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0x23ff): undefined reference to `send@16' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0x2425): undefined reference to `send@16' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0x358f): undefined reference to `send@16' TestRunnerClient.o:TestRunnerClient.cpp:(.text+0x35b5): more undefined references to `send@16' follow TestRunnerClient.o:TestRunnerClient.cpp:(.text+0x3a7a): undefined reference to `select@20' c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: TestRunnerClient.o: bad reloc address 0x2 in section `.text$_ZN7CppUnit12TestListenerD1Ev[__ZN7CppUnit12TestListenerD1Ev]'

  • c++のビルドエラーについて

    昨日からc++を学習し始めました。 pythonは2年ほどになりますが、c++は初めてだったので、コンパイルでエラーが起こってしまいわからなくなってしまったので質問させていただきました。 hello worldを出力しようと思いやってみたのですが、どこでエラーが起こっているのかがわかりません。 下記が私の書いたソースコードです。 #include <iostream> using namespace std; int main(){ cout << "HelloWorld." << endl; } エラーメッセージ C:\Users\ユーザー名\AppData\Local\Temp\ccKwbLoc.o: In function `main': C:/Users/ユーザー名/Documents/cpp/hello.cpp:4: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)' C:/Users/ユーザー名/Documents/cpp/hello.cpp:4: undefined reference to `std::ostream::operator<<(std::ostream& (*)(std::ostream&))' C:\Users\ユーザー名\AppData\Local\Temp\ccKwbLoc.o: In function `__tcf_0': C:/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/iostream:74: undefined reference to `std::ios_base::Init::~Init()' C:\Users\ユーザー名\AppData\Local\Temp\ccKwbLoc.o: In function `__static_initialization_and_destruction_0': t::Init()' e to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)' C:\Users\ユーザー名\AppData\Local\Temp\ccKwbLoc.o:hello.cpp:(.rdata$.refptr._ZSt4cout[.refptr._ZSt4cout]+0x0): undefined reference to `std::cout' collect2.exe: error: ld returned 1 exit status os:windows11 home 64ビット コンパイラ gcc (x86_64-posix-sjlj-rev0, Built by MinGW-W64 project) 8.1.0 エディタ:vscode よろしくお願いいたします。

  • WinGWのC++コンパイラの設定について

    WinGWのC++コンパイラの設定について いつもお世話になっています。 C++ソースをコンパイルできなくて困っています。 原因は何なのでしょうか。 >g++ SampleC.cc Info: resolving __fmode by linking to __imp___fmode (auto-import) Info: resolving __fpreset by linking to __imp___fpreset (auto-import) C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe: warning: a uto-importing has been activated without --enable-auto-import specified on the c ommand line. This should work unless it involves constant data structures referencing symbols from auto-imported DLLs. /mingw/lib/crt2.o:crt1.c:(.text+0x37): undefined reference to `__cpu_features_in it' /mingw/lib/crt2.o:crt1.c:(.text+0x89): undefined reference to `_pei386_runtime_r elocator' fu000001.o:(.idata$2+0xc): undefined reference to `libmsvcrt_a_iname' fu000002.o:(.idata$2+0xc): undefined reference to `libmsvcrt_a_iname' fu000004.o:(.idata$2+0xc): undefined reference to `libmsvcrt_a_iname' fu000005.o:(.idata$2+0xc): undefined reference to `libmsvcrt_a_iname' nmth000000.o:(.idata$4+0x0): undefined reference to `_nm___fmode' nmth000003.o:(.idata$4+0x0): undefined reference to `_nm___fpreset' collect2: ld returned 1 exit status ソース内容 /* hello world program */ #include <stdio.h> int main(void) { printf("hello world!\n"); return 0; }

  • Makefileの複数Targetの記述法

    現在A,B,Cの複数のターゲットに対する以下のようなMakefileをかいております。 SRC = A.cc B.cc C.cc TGT = $(basename $(SRC)) all:TGT A: A.cc g++ A.cc -o A B: B.cc g++ B.cc -o B C: C.cc g++ C.cc -o C A,B,Cに対する動作は同じであるため共通化して書きたいのですが、何か良い方法はありますでしょうか? patdubdt, for each等を用いて記述しようとしましたがうまくいきませんでした。 ご存知の方おられましたらご教授よろしくお願いいたします。

  • コンパイル

    コンパイルしましたが、\mingw\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe: cannot find -ldb-4.5 collect2 ld returned 1 exit statusというメッセージが表示されます。 コマンドプロンプトでcd C:\Users\xxxxx\Desktop\srcと入力し、cobc -x -std=cobol85 pro1.cblと入力した結果です。ソースはC:\Users\xxxxx\Desktop\srcにあります。MinGWとOpenCOBOLの動作確認はできています。

  • Fedora7で libpthread.aをリンクすると、コンパイルエラーになってしまいました

    はじめまして、 Fedora7でマルチスレッドのプログラムをビルドし、 libpthread.aをリンクしたところ、コンパイルエラーになってしまいました。 Fedora4~5では、起きなかったため、 libpthread.aのバージョン変更により、問題がおきたのではないかと思っております。 libpthreadのバージョンは2.6-4で [root@localhost]# rpm -qf /usr/lib/libpthread.a glibc-devel-2.6-4 glibc-develをダウングレードしようと思いましたが、 glibc-commonの依存関係が厳しく、forceしてもうまくいきませんでした。 makeのエラーは下記の内容で、main.cppにlibpthread.aをリンクしてビルドすると、 libpthread.a内で使ってる関数がundefinedでこけてしまいます。 ネットを検索して、pthreadのについて書かれているサイトを読みましたが、あまり見つからずどうして良いやらわからない状態です。 ttp://uyota.asablo.jp/blog/2007/01/27/1142762 Fedora7でlibpthread.aをリンクし、 undefinedを回避して、うまくビルドする方法をご存知でしたら、お教えください。 ---------------- エラー内容 [root@localhost test]# make make clean make[1]: ディレクトリ `/src/test' に入ります rm Main.o removed `Main.o' make[1]: ディレクトリ `/src/test' から出ます make test make[1]: ディレクトリ `/src/test' に入ります g++ -c -o Main.o Main.cpp g++ -o test Main.o /usr/lib/libpthread.a -lpthread /usr/lib/libpthread.a(pthread_create.o): In function `pthread_create': (.text+0xca3): undefined reference to `_dl_stack_flags' /usr/lib/libpthread.a(pthread_create.o): In function `pthread_create': (.text+0x1126): undefined reference to `_dl_stack_flags' /usr/lib/libpthread.a(ptw-accept.o): In function `accept': (.text+0x23): undefined reference to `__syscall_error' /usr/lib/libpthread.a(ptw-accept.o): In function `accept': (.text+0x52): undefined reference to `__syscall_error' /usr/lib/libpthread.a(ptw-send.o): In function `__send': (.text+0x23): undefined reference to `__syscall_error' /usr/lib/libpthread.a(ptw-send.o): In function `__send': (.text+0x52): undefined reference to `__syscall_error' /usr/lib/libpthread.a(ptw-pause.o): In function `__pause_nocancel': (.text+0x18): undefined reference to `__syscall_error' /usr/lib/libpthread.a(ptw-pause.o):(.text+0x3b): more undefined references to `__syscall_error' follow /usr/lib/libpthread.a(init.o): In function `__pthread_initialize_minimal': (.text+0x16c): undefined reference to `__libc_setup_tls' /usr/lib/libpthread.a(init.o): In function `__pthread_initialize_minimal': (.text+0x328): undefined reference to `_dl_init_static_tls' /usr/lib/libpthread.a(init.o): In function `__pthread_initialize_minimal': (.text+0x34d): undefined reference to `_dl_wait_lookup_done' /usr/lib/libpthread.a(ptw-read.o): In function `__read_nocancel': (.text+0x26): undefined reference to `__syscall_error' /usr/lib/libpthread.a(ptw-read.o): In function `__read_nocancel': (.text+0x56): undefined reference to `__syscall_error' /usr/lib/libpthread.a(ptw-open.o): In function `__open_nocancel': (.text+0x26): undefined reference to `__syscall_error' /usr/lib/libpthread.a(ptw-open.o): In function `__open_nocancel': (.text+0x56): undefined reference to `__syscall_error' /usr/lib/libpthread.a(sigaction.o): In function `__libc_sigaction': (.text+0x60): undefined reference to `_dl_sysinfo_dso' /usr/lib/libpthread.a(sigaction.o): In function `sigaction': (.text+0x19a): undefined reference to `_dl_sysinfo_dso' collect2: ld はステータス 1 で終了しました make[1]: *** [test] エラー 1 make[1]: ディレクトリ `/src/test' から出ます make: *** [build] エラー 2 -- [root@localhost]# cat /etc/ld.so.conf /usr/lib include ld.so.conf.d/*.conf

  • MingwでC++のソースがコンパイルできない。

    質問があるのですがよろしくお願いしします。 プラットフォームは Windows HOME です。 MinGWでC++のhelloworld.cppという名前のプログラム ------ここから----------- #include <iostream> using namespace std; int main(){ cout <<"Hello World!!\n"; return 0; } -------ここまで----------- を、gcc helloworld.cpp とWindowsのコマンドプロンプトから打ってコンパイルしようとしたのですが、 undefined reference to std string::size() const undefined reference to std string::operator[](using int) const undefinrd reference to std::cout undefinrd reference to std::basic_ostream<char, std::char traits<char> >&, char const*) undefinrd reference to std::ios_base::Init::() undefinrd reference to std::ios_base::~Init::() などのエラーが出て、コンパイルできません・・ hello.cという名前のC言語プログラム --------ここから------ #include<stdio.h> int main(void){ printf("Hello GCC World on Windows!!\n"); } ------ここまで------- は、gcc hello.c で正常にコンパイルでき、生成したexeファイルも正常に動きます。 また、eclipse CDT上からc++プログラムをMinGWでコンパイルすることもできるのですが・・ なぜかWindowsのコマンドプロンプトからc++プログラムをコンパイルしようとするとエラーが出てしまいます。(C言語のプログラムでもエラーが出ることが時々あります。) どなたか詳しい方いらっしゃいましたらご教授頂けると幸いです。 よろしくお願いします。

専門家に質問してみよう