axpokl / MineSweeperTetris

https://store.steampowered.com/app/2204230/_/
GNU General Public License v3.0
27 stars 7 forks source link

Cannot build it #5

Open charlie89 opened 2 weeks ago

charlie89 commented 2 weeks ago

Hi,

I want to compile this software. There are no build instructions, so i tried the obvious way of running make.bat, which needs g++ so i installed that like described in https://code.visualstudio.com/docs/cpp/config-mingw. And i also tried https://nuwen.net/mingw.html#install. But i always get the same errors:

MineSweeperTetris>g++ -static -Os -s main.cpp icon.res -o MineSweeperTetris.exe -lwinmm -lgdiplus -lgdi32 -lmsimg32 -lsteam_api -mwindows
In file included from main.cpp:4:
disp.cpp: In function 'void WinCreateMain()':
disp.cpp:429:13: error: ordered comparison of pointer with integer zero ('HWND' {aka 'HWND__*'} and 'int')
  429 |     if (_hw > 0)
      |         ~~~~^~~
disp.cpp: In function 'long unsigned int GetHwnd(pbitmap)':
disp.cpp:763:12: error: cast from 'HGDIOBJ' {aka 'void*'} to 'long unsigned int' loses precision [-fpermissive]
  763 |     return (unsigned long)b->Handle;
      |            ^~~~~~~~~~~~~~~~~~~~~~~~
disp.cpp: In function 'long unsigned int GetHwnd()':
disp.cpp:767:12: error: cast from 'HWND' {aka 'HWND__*'} to 'long unsigned int' loses precision [-fpermissive]
  767 |     return (unsigned long)_hw;
      |            ^~~~~~~~~~~~~~~~~~
disp.cpp: In function 'long unsigned int GetDraw(pbitmap)':
disp.cpp:771:12: error: cast from 'HDC' {aka 'HDC__*'} to 'long unsigned int' loses precision [-fpermissive]
  771 |     return (unsigned long)b->DC;
      |            ^~~~~~~~~~~~~~~~~~~~
disp.cpp: In function 'long unsigned int GetDraw()':
disp.cpp:775:12: error: cast from 'HDC' {aka 'HDC__*'} to 'long unsigned int' loses precision [-fpermissive]
  775 |     return (unsigned long)_dc;
      |            ^~~~~~~~~~~~~~~~~~
In file included from main.cpp:12:
window.cpp: In member function 'void Window::loadall()':
window.cpp:346:26: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  346 |         SetWindowLongPtr((HWND)GetHwnd(), GWL_STYLE, WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_VISIBLE);
      |                          ^~~~~~~~~~~~~~~
window.cpp: In member function 'void Window::loadicon()':
window.cpp:377:19: error: ordered comparison of pointer with integer zero ('HICON' {aka 'HICON__*'} and 'int')
  377 |     if (hicon_res > 0)
      |         ~~~~~~~~~~^~~

I'm doing this on Windows 11 23H2. How can i get this to compile successfully?

I just want to make the adding of new blocks way slower, cause even on easy this is just way too fast for me. I want to play this game to relax, not to get additional stress. Oh and when running it via steam on linux with the dark theme the window often is just a black screen until the mouse is moved again. Maybe i find time to fix that, but i need to be able to compile it for that... Great game btw.

Thanks, Charlie

axpokl commented 2 weeks ago

Hi,

I want to compile this software. There are no build instructions, so i tried the obvious way of running make.bat, which needs g++ so i installed that like described in https://code.visualstudio.com/docs/cpp/config-mingw. And i also tried https://nuwen.net/mingw.html#install. But i always get the same errors:

MineSweeperTetris>g++ -static -Os -s main.cpp icon.res -o MineSweeperTetris.exe -lwinmm -lgdiplus -lgdi32 -lmsimg32 -lsteam_api -mwindows
In file included from main.cpp:4:
disp.cpp: In function 'void WinCreateMain()':
disp.cpp:429:13: error: ordered comparison of pointer with integer zero ('HWND' {aka 'HWND__*'} and 'int')
  429 |     if (_hw > 0)
      |         ~~~~^~~
disp.cpp: In function 'long unsigned int GetHwnd(pbitmap)':
disp.cpp:763:12: error: cast from 'HGDIOBJ' {aka 'void*'} to 'long unsigned int' loses precision [-fpermissive]
  763 |     return (unsigned long)b->Handle;
      |            ^~~~~~~~~~~~~~~~~~~~~~~~
disp.cpp: In function 'long unsigned int GetHwnd()':
disp.cpp:767:12: error: cast from 'HWND' {aka 'HWND__*'} to 'long unsigned int' loses precision [-fpermissive]
  767 |     return (unsigned long)_hw;
      |            ^~~~~~~~~~~~~~~~~~
disp.cpp: In function 'long unsigned int GetDraw(pbitmap)':
disp.cpp:771:12: error: cast from 'HDC' {aka 'HDC__*'} to 'long unsigned int' loses precision [-fpermissive]
  771 |     return (unsigned long)b->DC;
      |            ^~~~~~~~~~~~~~~~~~~~
disp.cpp: In function 'long unsigned int GetDraw()':
disp.cpp:775:12: error: cast from 'HDC' {aka 'HDC__*'} to 'long unsigned int' loses precision [-fpermissive]
  775 |     return (unsigned long)_dc;
      |            ^~~~~~~~~~~~~~~~~~
In file included from main.cpp:12:
window.cpp: In member function 'void Window::loadall()':
window.cpp:346:26: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  346 |         SetWindowLongPtr((HWND)GetHwnd(), GWL_STYLE, WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_VISIBLE);
      |                          ^~~~~~~~~~~~~~~
window.cpp: In member function 'void Window::loadicon()':
window.cpp:377:19: error: ordered comparison of pointer with integer zero ('HICON' {aka 'HICON__*'} and 'int')
  377 |     if (hicon_res > 0)
      |         ~~~~~~~~~~^~~

I'm doing this on Windows 11 23H2. How can i get this to compile successfully?

I just want to make the adding of new blocks way slower, cause even on easy this is just way too fast for me. I want to play this game to relax, not to get additional stress. Oh and when running it via steam on linux with the dark theme the window often is just a black screen until the mouse is moved again. Maybe i find time to fix that, but i need to be able to compile it for that... Great game btw.

Thanks, Charlie

Hi charlie89,

I have modify this part of code to avoid type conversion, you may try complie again. The complier is ming32 with g++.exe (MinGW.org GCC-6.3.0-1) 6.3.0 I haven't test to run the game under Linux as the game was designed under Windows system.