前提・実現したいこと
MinGw でコンパイルするとGxLibをリンクできません。
発生している問題・エラーメッセージ
C:\bin\program>g++ test02.cpp -I"C:\MinGW\include" -L"C:\MinGW\lib" -DDX_GCC_COMPILE -DDX_NON_INLINE_ASM -lDxLib -lDxUseCLib -lDxDrawFunc -ljpeg -lpng -lzlib -ltiff -ltheora_static -lvorbis_static -l
vorbisfile_static -logg_static -lbulletdynamics -lbulletcollision -lbulletmath -lopusfile -lopus -ls
ilk_common -lcelt -o test02.exe
C:\Users\teraj\AppData\Local\Temp\cc0p7dvJ.o:test02.cpp:(.text+0x7): undefined reference to DxLib::DxLib_Init()' C:\Users\teraj\AppData\Local\Temp\cc0p7dvJ.o:test02.cpp:(.text+0x34): undefined reference to
DxLib::GetColor(int, int, int)'
C:\Users\teraj\AppData\Local\Temp\cc0p7dvJ.o:test02.cpp:(.text+0x4c): undefined reference to DxLib::DrawPixel(int, int, unsigned int)' C:\Users\teraj\AppData\Local\Temp\cc0p7dvJ.o:test02.cpp:(.text+0x51): undefined reference to
DxLib::WaitKey()'
C:\Users\teraj\AppData\Local\Temp\cc0p7dvJ.o:test02.cpp:(.text+0x56): undefined reference to `DxLib::DxLib_End()'
collect2.exe: error: ld returned 1 exit status
該当のソースコード
test02.cpp
cpp
1#define DDX_GCC_COMPILE 2#define DDX_NON_INLINE_ASM 3 4#include "DxLib.h" 5 6using namespace std; 7 8// プログラムは WinMain から始まります 9int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) 10{ 11 if( DxLib_Init() == -1 ) // DXライブラリ初期化処理 12 { 13 return -1 ; // エラーが起きたら直ちに終了 14 } 15 16 DrawPixel( 320 , 240 , GetColor( 255,255,255 ) ) ; // 点を打つ 17 18 WaitKey() ; // キー入力待ち 19 20 DxLib_End() ; // DXライブラリ使用の終了処理 21 22 return 0 ; // ソフトの終了 23} 24
試したこと
C:\MinGW\include にGxLibの各種ヘッダーファイルをいれ、
C:\MinGW\libにGxLibの各種ライブラリーファイルをいれてg++でコンパイルするもエラーがでてtest02.exeファイルができません。バージョンのせいなのでしょうか。先に同様な投稿がありまねしましたが、うまくいきませんでした。
補足情報(FW/ツールのバージョンなど)
MinGwはhttp://sourceforge.net/projects/mingw/files/latest/download からダウンロードしたversion 6.3.0です。DXライブラリはhttp://dxlib.o.oo7.jp/dxdload.html からダウンロードしたDXライブラリ Windows版 Gnu C++( MinGW )用(Ver3.19)をダウンロードする(自己解凍形式(約27.4MB))です。プロジェクトに追加すべきファイル_GCC(MinGW)用\5_2_0_w64\x86_64の中のものを使いました。
回答2件
あなたの回答
tips
プレビュー