ページ 1 / 1
mingw64でのDxlib使用法
Posted: 2018年11月30日(金) 23:12
by h1j1k1
コンパイラ x86_64-7.3.0-win32-seh-rt_v5-rev0
OS Win7
ファイル構成
Workspace
┝Dxlib
│└DxlibGCCのコピー
┝main.cpp
└main.o
上記の環境において、Dxlibを使用しようと思い、テストプログラムを動かしてみました。
ところが、下記のようなエラーが出てしまいました。
どなたか原因究明お願いします。
► スポイラーを表示
C:\Workspace>g++ -g -O2 -w -static-libgcc -static-libstdc++ -I"./DxLib/" -L"./DxLib/" -DDX_GCC_COMPILE -DDX_NON_INLINE_ASM -o test main.o -lDxLib -lDxUseCLib -lDxDrawFunc -ljpeg -lpng -lzlib -ltheora_static -lvorbis_static -lvorbisfile_static -logg_static -lbulletdynamics -lbulletcollision -lbulletmath -lgdi32
./DxLib//libDxUseCLib.a(DxUseCLib.o):DxUseCLib.cpp:(.text+0x65e): undefined refe
rence to `TIFFClientOpen'
./DxLib//libDxUseCLib.a(DxUseCLib.o):DxUseCLib.cpp:(.text+0x67c): undefined refe
rence to `TIFFGetField'
./DxLib//libDxUseCLib.a(DxUseCLib.o):DxUseCLib.cpp:(.text+0x68e): undefined refe
rence to `TIFFGetField'
./DxLib//libDxUseCLib.a(DxUseCLib.o):DxUseCLib.cpp:(.text+0x6a0): undefined refe
rence to `TIFFGetField'
./DxLib//libDxUseCLib.a(DxUseCLib.o):DxUseCLib.cpp:(.text+0x6b2): undefined refe
rence to `TIFFGetField'
./DxLib//libDxUseCLib.a(DxUseCLib.o):DxUseCLib.cpp:(.text+0x6c4): undefined refe
rence to `TIFFGetField'
./DxLib//libDxUseCLib.a(DxUseCLib.o):DxUseCLib.cpp:(.text+0x6d6): more undefined
references to `TIFFGetField' follow
./DxLib//libDxUseCLib.a(DxUseCLib.o):DxUseCLib.cpp:(.text+0x718): undefined refe
rence to `TIFFClose'
./DxLib//libDxUseCLib.a(DxUseCLib.o):DxUseCLib.cpp:(.text+0x75e): undefined refe
rence to `TIFFClose'
./DxLib//libDxUseCLib.a(DxUseCLib.o):DxUseCLib.cpp:(.text+0x810): undefined refe
rence to `TIFFReadRGBAStrip'
./DxLib//libDxUseCLib.a(DxUseCLibOgg.o):DxUseCLibOgg.cpp:(.text+0x3802): undefin
ed reference to `op_pcm_total'
./DxLib//libDxUseCLib.a(DxUseCLibOgg.o):DxUseCLibOgg.cpp:(.text+0x3879): undefin
ed reference to `op_open_callbacks'
./DxLib//libDxUseCLib.a(DxUseCLibOgg.o):DxUseCLibOgg.cpp:(.text+0x389a): undefin
ed reference to `op_head'
./DxLib//libDxUseCLib.a(DxUseCLibOgg.o):DxUseCLibOgg.cpp:(.text+0x38f8): undefin
ed reference to `op_pcm_total'
./DxLib//libDxUseCLib.a(DxUseCLibOgg.o):DxUseCLibOgg.cpp:(.text+0x394b): undefin
ed reference to `op_free'
./DxLib//libDxUseCLib.a(DxUseCLibOgg.o):DxUseCLibOgg.cpp:(.text+0x3987): undefin
ed reference to `op_read'
./DxLib//libDxUseCLib.a(DxUseCLibOgg.o):DxUseCLibOgg.cpp:(.text+0x39c4): undefin
ed reference to `op_pcm_seek'
./DxLib//libDxUseCLib.a(DxUseCLibOgg.o):DxUseCLibOgg.cpp:(.text+0x3a12): undefin
ed reference to `op_pcm_total'
collect2.exe: error: ld returned 1 exit status
make: *** [make_dxlib.mak:18: test] Error 1
コード:
// main.cpp
#include "./DxLib/DxLib.h"
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
{
ChangeWindowMode(TRUE);
if( DxLib_Init() == -1 )
{
return -1 ;
}
// DrawPixel( 320 , 240 , GetColor( 255,255,255 ) ) ; // Šh˘
DrawCircle(320,240,0xffffff,TRUE);
WaitKey() ;
DxLib_End() ;
return 0 ;
}
Re: mingw64でのDxlib使用法
Posted: 2018年12月01日(土) 05:00
by あたっしゅ
DxLib って 32bit じゃなかった ?
DxLib のソースから 64bit でコンパイルし直せば、64bit でも使えるんじゃないか ?
Re: mingw64でのDxlib使用法
Posted: 2018年12月01日(土) 07:16
by h1j1k1
なるほど、根本的なところから違いましたか
ありがとうございます
Re: mingw64でのDxlib使用法
Posted: 2018年12月01日(土) 10:07
by Bull
私自身 mingw64 で DXライブラリを使用していないのですが、もしかして指定するライブラリが足らないのでは?
-ltiff とか -lopusfile とか。
参考
Gnu C++ (MinGW)によるDXライブラリの使い方
Re: mingw64でのDxlib使用法
Posted: 2018年12月01日(土) 13:06
by h1j1k1
>>#2
コンパイルの方法がわかりません。
下記の簡素なBatを組んで全ファイルをコンパイルしようとしても、エラーが出ました。
正しい方法があるのでしたら、教えていただけると幸いです。
※補足
Visual Studioはインストール済みですが、VSでGCCを使うやり方がわかりません。
コード:
:loop
if '%1'=='' goto end
g++ -g -O2 -w -c %1
shift
goto loop
:end
@echo end
pause
>>#4 bullさん
上記サイトを参考にしてMakefileを書いたのですが、コピペミスがあったようです。
ありがとうございます
Re: mingw64でのDxlib使用法
Posted: 2018年12月03日(月) 01:10
by みけCAT
-m32オプションを使うことで、32ビットモードでコンパイルできるはずだと思います。
(「コンパイル」はできても、32ビット用ライブラリが無い環境だと「リンク」に失敗することがあります)
Re: mingw64でのDxlib使用法
Posted: 2018年12月04日(火) 17:56
by h1j1k1
申し訳ございません。
Bullさんの指摘の通り行い、再度オプションコピペをしたところ、正常に動作しました。
あたっしゅさん、みけキャットさん申し訳ございませんでした。