|
ForumsSega Master System / Mark III / Game GearSG-1000 / SC-3000 / SF-7000 / OMV |
Home - Forums - Games - Scans - Maps - Cheats - Credits Music - Videos - Development - Hacks - Translations - Homebrew |
![]() |
Author | Message |
---|---|
|
Compiling MEKA on Qt Creator (Windows, Mingw)
![]() Last edited by alb3530 on Mon Jun 04, 2012 4:22 am; edited 2 times in total |
I'm trying to compile Meka on Qt creator, and here is my progress so far:
I have modified the code "on-demand" to get rid of compiler errors when trying to compile. I've got the sources from svn by May 5, 2012 Here is what's been changed up to now: Sources: ![]() .pro file is currently like this: #TEMPLATE = app #CONFIG += console CONFIG -= qt #Globals #DEFINES-=ALLEGRO_HAVE_SYS_TYPES_H DEFINES+= MARAT_Z80 MEKA_ZIP MEKA_PNG MEKA_JOY ASM_SYMBOLS_REQUIRE_UNDERSCORE QMAKE_CFLAGS_RELEASE+= "-std=c99 -fno-pcc-struct-return -fno-exceptions" #ASM ASM_SOURCES += videoasm.asm \ eagle.asm \ hq2x16.asm \ mappersa.asm \ hq2x32.asm #NASM specifics QMAKE_EXTRA_COMPILERS += nasm DEF_OS = -DARCH_WIN32 -DX86_ASM OTHER_FILES += $$ASM_SOURCES NASM_INCLUDES = $$join(INCLUDEPATH," -i ","-i ") nasm.output = ${QMAKE_FILE_BASE}.o nasm.commands = nasm $(DEF_OS) -f win32 $$NASM_INCLUDES -o ${QMAKE_FILE_BASE}.o ${QMAKE_FILE_NAME} nasm.input = ASM_SOURCES LIBS+=videoasm.o eagle.o hq2x16.o mappersa.o videoasm.o hq2x32.o #Specific DEFINES+="ASM=nasm" "X86_ASM=yes" QMAKE_LIBS_WINDOWS+=-lddraw -ldsound -ldinput -ldxguid -laudio -lgdi INCLUDEPATH += \ "C:\\ALB3530\\INCLUDES\\libs\\libpng\\lib" \ "C:\\ALB3530\\INCLUDES\\Allegro\\include\\allegro5" \ "C:\\ALB3530\\INCLUDES\\Allegro\\include" \ "C:\\ALB3530\\INCLUDES\\DJGPP\\include" \ "C:\\ALB3530\\DEV\\Meka\\tools" \ "C:\\ALB3530\\INCLUDES\\zlib" \ "C:\\ALB3530\\INCLUDES\\DirectX\\include" SOURCES += \ vmachine.c \ vlfn.c \ video_t.c \ video_sp.c \ video_m5.c \ video_m2.c \ video_c.c \ video.c \ vdp.c \ tvtype.c \ tvoekaki.c \ tools_t.c \ tools.c \ textbox.c \ sportpad.c \ specials.c \ skin_bg.c \ skin.c \ sg1ksc3k.c \ sf7000.c \ setup.c \ sdsc.c \ saves.c \ rapidfir.c \ patch.c \ palette.c \ nes_ppu.c \ nes_pal.c \ nes_maps.c \ nes.c \ misc.c \ message.c \ memory.c \ meka.c \ mappers.c \ mainloop.c \ machine.c \ lightgun.c \ keyinfo.c \ keyboard.c \ ioports.c \ inputs_u.c \ inputs_t.c \ inputs_i.c \ inputs_f.c \ inputs_c.c \ inputs.c \ hq2x.c \ gui.c \ glasses.c \ games.c \ g_widget.c \ g_update.c \ g_tools.c \ g_mouse.c \ g_menu_t.c \ g_menu_i.c \ g_menu.c \ g_init.c \ g_file.c \ g_colors.c \ g_box.c \ g_action.c \ fskipper.c \ fonts.c \ file.c \ fdc765.c \ errors.c \ effects.c \ eeprom.c \ drivers.c \ desktop.c \ debugger.c \ db.c \ datadump.c \ data.c \ cpu.c \ country.c \ config_v.c \ config_j.c \ config.c \ commport.c \ coleco.c \ checksum.c \ capture.c \ buildupd.c \ bmemory.c \ blitintf.c \ blit_c.c \ blit.c \ bios.c \ beam.c \ areplay.c \ app_tileview.c \ app_textview.c \ app_techinfo.c \ app_palview.c \ app_options.c \ app_memview.c \ app_mapview.c \ app_game.c \ app_about.c \ OTHER_FILES += \ videoasm.asm \ object_script.Meka.Release \ object_script.Meka.Debug \ mekaw.res \ mekaw.rc \ mekaw.ico \ meka.ico \ mappersa.asm \ hq2x32.asm \ hq2x16.asm \ eagle.asm HEADERS += \ vmachine.h \ vlfn.h \ video_m5.h \ video_m2.h \ video_c.h \ video.h \ vdp.h \ tvtype.h \ tvoekaki.h \ tools_t.h \ tools.h \ textbox.h \ system.h \ sportpad.h \ specials.h \ skin_bg.h \ skin.h \ shared.h \ sg1ksc3k.h \ sf7000.h \ setup.h \ sdsc.h \ saves.h \ rapidfir.h \ patch.h \ palette.h \ nes_ppu.h \ nes_maps.h \ nes.h \ misc.h \ message.h \ memory.h \ meka.h \ mappers.h \ mainloop.h \ machine.h \ lightgun.h \ keyinfo.h \ keyboard.h \ ioports.h \ inputs_u.h \ inputs_t.h \ inputs_i.h \ inputs_f.h \ inputs_c.h \ inputs.h \ hq2x.h \ gui.h \ glasses.h \ games.h \ g_widget.h \ g_update.h \ g_tools.h \ g_mouse.h \ g_menu_t.h \ g_menu_i.h \ g_menu.h \ g_init.h \ g_file.h \ g_box.h \ g_applet.h \ g_action.h \ fskipper.h \ fonts.h \ file.h \ fdc765.h \ errors.h \ effects.h \ eeprom.h \ eagle.h \ drivers.h \ desktop.h \ debugger.h \ db.h \ datadump.h \ data.h \ cpu.h \ country.h \ config_v.h \ config_j.h \ config.h \ commport.h \ coleco.h \ checksum.h \ capture.h \ build.h \ bmemory.h \ blitintf.h \ blit_c.h \ blit.h \ bios.h \ beam.h \ areplay.h \ app_tileview.h \ app_textview.h \ app_techinfo.h \ app_palview.h \ app_options.h \ app_memview.h \ app_mapview.h \ app_game.h \ app_about.h However, before trying something more, I'd like to understand some things I've noticed in the sources, that I'm quite trying to catch the idea about them: 1 - In "video_sp.c", there's some names that the compiler states as "undeclared", like so: C:\ALB3530\DEV\Meka\video_sp.c:45: error: 'SPR_AREA' undeclared (first use in this function) C:\ALB3530\DEV\Meka\video_sp.c:103: error: 'TGFX_TYPE' has no member named 'Base_Sprite' C:\ALB3530\DEV\Meka\video_sp.c:63: error: 'Sprite_Shift_X' undeclared (first use in this function) Apart from the above, I've declared (probably that's not right) some names: Original ("y" is given as undeclared): y = SPR_AREA [j]; Changed (no error given by the compiler): int y = SPR_AREA [j]; Also, there's a switch statement outside a function.It is supposed to work?My approach was adding a main() function and put the statement inside it. Now, I realize there's a similar switch statement inside "video_m5.c"...?Is "video_sp.c" a useful file, or I can simply make it blank? 2 - In "palette.h", in that line: extern RGB Palette_Emulation[PALETTE_EMU_GAME_SIZE]; Where is "RGB" supposed to be defined? Error displayed by the compiler is: C:\ALB3530\DEV\Meka\palette.h:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Palette_Emulation' 3 - Where is "BITMAP" supposed to be defined? Compiler is telling about unexisting members, as you can see below: video_m2.c:76: error: 'BITMAP' has no member named 'vtable' video_m2.c:84: error: 'BITMAP' has no member named 'line' 4 - What about FONT, in fonts.c and fonts.h?Is it supposed to be ALLEGRO_FONT? Finally, that's the current compiler output: 15:23:50: Running steps for project Meka... 15:23:50: Configuration unchanged, skipping qmake step. 15:23:50: Starting: "C:\ALB3530\QtSDK\mingw\bin\mingw32-make.exe" C:/ALB3530/QtSDK/mingw/bin/mingw32-make -f Makefile.Release mingw32-make[1]: Entering directory `C:/ALB3530/DEV/Meka' gcc -c -O2 -std=c99 -fno-pcc-struct-return -fno-exceptions -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DMARAT_Z80 -DMEKA_ZIP -DMEKA_PNG -DMEKA_JOY -DASM_SYMBOLS_REQUIRE_UNDERSCORE -DASM=nasm -DX86_ASM=yes -DQT_NEEDS_QMAIN -I"..\..\INCLUDES\libs\libpng\lib" -I"..\..\INCLUDES\Allegro\include\allegro5" -I"..\..\INCLUDES\Allegro\include" -I"..\..\INCLUDES\DJGPP\include" -I"tools" -I"..\..\INCLUDES\zlib" -I"..\..\INCLUDES\DirectX\include" -I"..\..\QtSDK\Desktop\Qt\4.8.1\mingw\mkspecs\win32-g++" -o release\video_m5.o video_m5.c mingw32-make[1]: Leaving directory `C:/ALB3530/DEV/Meka' In file included from video_m5.c:10: palette.h:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Palette_Emulation' palette.h:37: error: expected declaration specifiers or '...' before 'RGB' palette.h:39: error: expected ')' before '*' token palette.h:40: error: expected ')' before '*' token video_m5.c: In function 'VDP_Mode4_DrawTile': video_m5.c:47: error: 'BITMAP' has no member named 'vtable' video_m5.c:60: error: 'BITMAP' has no member named 'line' video_m5.c:77: error: 'BITMAP' has no member named 'line' video_m5.c:97: error: 'BITMAP' has no member named 'line' video_m5.c:114: error: 'BITMAP' has no member named 'line' video_m5.c:140: error: 'BITMAP' has no member named 'line' video_m5.c:157: error: 'BITMAP' has no member named 'line' video_m5.c:177: error: 'BITMAP' has no member named 'line' video_m5.c:194: error: 'BITMAP' has no member named 'line' video_m5.c:211: error: 'BITMAP' has no member named 'vtable' video_m5.c: In function 'Refresh_Line_5': video_m5.c:221: error: 'BITMAP' has no member named 'line' video_m5.c:238: warning: implicit declaration of function 'makecol16' video_m5.c: In function 'Sprite_Draw_Line': video_m5.c:504: warning: 'GFX_Line16' is static but used in inline function 'Sprite_Draw_Line' which is not static video_m5.c:505: warning: 'Sprites_Draw_Mask' is static but used in inline function 'Sprite_Draw_Line' which is not static video_m5.c: In function 'Sprite_Draw_Line_Double': video_m5.c:527: warning: 'GFX_Line16' is static but used in inline function 'Sprite_Draw_Line_Double' which is not static video_m5.c:528: warning: 'Sprites_Draw_Mask' is static but used in inline function 'Sprite_Draw_Line_Double' which is not static mingw32-make[1]: *** [release/video_m5.o] Error 1 mingw32-make: *** [release] Error 2 15:23:50: The process "C:\ALB3530\QtSDK\mingw\bin\mingw32-make.exe" exited with code 2. Error while building/deploying project Meka (target: Desktop) When executing step 'Make' Comments are welcome Best regards |
|
![]() ![]() |
|
|
![]() |
Which SVN path have you checked from?
The latest code is in a branch (maybe I should move it to trunk really..) |
|
![]() ![]() ![]() |
|
|
![]() |
svn://svn.smspower.org/meka/branches/20110530-allegro5-sound
I suppose this' the branch you've talked about, right? My goal is to compile Meka 0.80 with the new sound engine Best regards |
|
![]() ![]() |
|
|
![]() |
I don't understand. The lines number quoted about video_m5.c does not match anything about my copy and I can't find BITMAP or RGB or FONT anywhere in the source code anymore. | |
![]() ![]() ![]() |
|
|
![]() |
I have just removed the branch and copy it back to the trunk, so the latest code is at:
svn://svn.smspower.org/meka/trunk/meka |
|
![]() ![]() ![]() |
|
|
![]() |
Wow, these are good news...I'm not messing with the code so wrongly then....
Great, I'll check out this and let you know Best regards |
|
![]() ![]() |
|
|
![]() |
I've downloaded the sources, and set up the environment.
The errors I was getting before aren't here anymore. This is the first change: system.h:20:18: error: vector: No such file or directory system.h:21:15: error: map: No such file or directory system.h:22:21: error: algorithm: No such file or directory In these lines: #include <vector> #include <map> #include <algorithm> All three files actually exist, and code completion finds them, but they are actually C++ libraries, and the C compiler doesn't accept them. I've then prefixed the files with the folder, like so: #include <c++/vector> #include <c++/map> #include <c++/algorithm> But then, compiler can't find some other files that are included inside them... Seems it's compiling in C compiler, but requiring C++ libraries. My first thought was renaming .h files to .h++, but I'm not sure if it's the best approach, since I might end up by being in charge of modifying several files, and I'm not willing to make such a drastic change if it's not really needed... I'll let you know if any progress occurs. Best regards |
|
![]() ![]() |
|
|
![]() |
MEKA uses a C++ compiler now despite the file extension being .c
Change your project file to use a C++ compiler |
|
![]() ![]() ![]() |
|
|
![]() |
Done. I've just faced another problem: g_colors.c:7:20: error: themes.h: No such file or directory I've realized these files in older sources of 0.71 : themes.c themes.h themes_b.c themes_b.h I've then added them, but some names are still undeclared (such as RGB) Is there some newer themes.h file? Best regards |
|
![]() ![]() |
|
|
![]() |
g_colors.c is not part of MEKA anymore. I noticed that there was a left-over file on SVN that I haven't deleted.
You should be using the file list from the Makefile. |
|
![]() ![]() ![]() |
|
|
![]() |
Ok, deleted it and went forward... Now I'm dealing with some Allegro undefined references: ./release\vmachine.o:vmachine.c:(.text+0x185): undefined reference to `al_set_target_bitmap' ./release\vmachine.o:vmachine.c:(.text+0x1be): undefined reference to `al_draw_bitmap' ./release\video_m2.o:video_m2.c:(.text+0x2c7e): undefined reference to `al_set_target_bitmap' These are just a few, cause there's a lot more.I'll fix them and keep you informed Best regards |
|
![]() ![]() |
|
|
![]() |
Allegro libraries were linked successfully....
After some problems with asm files (multiple definitions or undefined references), I'm not defining X86_ASM anymore. That seems to solve the problem. Next one: ./release\dasm.o:dasm.c:(.text+0x0): multiple definition of `main' ./release\meka.o:meka.c:(.text+0x68): first defined here Is it supposed to work in this way? Best regards |
|
![]() ![]() |
|
|
![]() |
dasm.c is not part of the MEKA executable.. it looks like most of your problems derive from the fact you aren't using the Makefile. | |
![]() ![]() ![]() |
|
|
![]() |
In fact, I'm not. I'm using qmake to create the makefile as I can't (or at least I think so) use the makefile that's provided in the sources. I've removed dasm.c. I thought about looking inside the makefile in order to find useless files (like dasm.c) but it can be hard, once files that aren't specified there can be included by other files.... For example, app_about.h and app_about.c aren't in the makefile, but they're needed... Another thing that's just happened was I got rid of undefined references to gdiplus symbols, after getting a modified version of gdiplus for mingw (libgdiplus) The only undefined references I have now are the following: c:\ALB3530\INCLUDES\Allegro\lib/liballegro_image-5.0.6-static-mt.a(pcx.o):pcx.c:(.text+0xa): undefined reference to `__chkstk_ms' c:\ALB3530\INCLUDES\Allegro\lib/liballegro_image-5.0.6-static-mt.a(bmp.o):bmp.c:(.text+0xe6): undefined reference to `__chkstk_ms' c:\ALB3530\INCLUDES\Allegro\lib/liballegro-5.0.6-static-mt.a(wjoydxnu.o):wjoydxnu.c:(.text+0x1502): undefined reference to `__chkstk_ms' c:\ALB3530\INCLUDES\Allegro\lib/liballegro-5.0.6-monolith-static-mt.a(high_primitives.o):high_primitives.c:(.text+0x2786): undefined reference to `__chkstk_ms' Maybe I have to dynamically link Allegro....? This __chkstk_ms seems to be a MSVC symbol..... Edit: I've replaced Allegro binaries for MinGW 4.6.2 by those for MinGW 4.5.0 and it's done.... I've just got the exe compiled in Qt Creator.... (finally) Now It's just a matter of configuring the post-build events (create folders, copying files and so on) and the job is done.... Best regards |
|
![]() ![]() |
|
|
![]() |
I didn't imagine it would actually run, but after the install has been done, Meka ran just fine!
I'll post a list of what I've done in order to compile Meka from Qt Creator as soon as I have time.... It was a long journey, but everything went well in the end. The only thing I'm not sure about is the DirectX support, which I think to be not available.Also, the icon is not there, but this should be able to fix. Best regards |
|
![]() ![]() |
![]() |