Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makefile for Linux #26

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

giampierosalvi
Copy link

This is a Makefile to build the examples in this repository on GNU Linux. It has been tested on Ubuntu 18.04. Running make will create temporary cpp file that are modified versions of the the original cpp files. Main differences are using olcConsoleGameEngineSDL.h instead of olcConsoleGameEngine.h and substituting the VK_SHIFT and VK_CONTROL flags.

You don't need to accept the pull request, I just wanted to let you know about it.

These are the programs that build and run at the moment:
OneLoneCoder_Asteroids
OneLoneCoder_Balls1
OneLoneCoder_ComandLineFPS_2
OneLoneCoder_Frogger
OneLoneCoder_GameOfLife
OneLoneCoder_Matrix
OneLoneCoder_Mazes
OneLoneCoder_OverEngineered
OneLoneCoder_PathFinding_AStar
OneLoneCoder_PerlinNoise
OneLoneCoder_PlatformGame1
OneLoneCoder_Pseudo3DPlanesMode7
OneLoneCoder_RetroArcadeRacer
OneLoneCoder_Splines1
OneLoneCoder_Splines2
OneLoneCoder_SpriteEditor

These are the ones that do not compile:
OneLoneCoder_AR_OpticFlow (missing escapi.h)
OneLoneCoder_Balls2 (missing function max)
OneLoneCoder_CaveDiver (imports Windows.h)
OneLoneCoder_CommandLineFPS (imports Windows.h)
OneLoneCoder_FlappyBird (imports Windows.h)
OneLoneCoder_LogitechG13Twitch (winsock2.h)
OneLoneCoder_LudumDare42 (missing function max)
OneLoneCoder_olcEngine3D_Part1-4 strange errors, haven't checked
OneLoneCoder_PanAndZoom (missing to_wstring)
OneLoneCoder_RacingLines (missing FillTriangle)
OneLoneCoder_Snake (imports Windows.h)
OneLoneCoder_Tetris (imports Windows.h)
OneLoneCoder_Webcam (missing escapi.h)
worms/OneLoneCoder_Worms1-3 (missing escapi.h)

@OneLoneCoder
Copy link
Owner

I like this, but do not have a sensible way to test it. What I will do is encourage people to examin this PR and use it as they see fit - so I wont close it down.

@JorgeG94
Copy link

I just compiled and tested the running programs, and they all run smoothly on Ubuntu 18.04. I have mint installed somewhere, so I can test that too.

@jonshouse1
Copy link

`Does not seem to work on my Linux Mint, any ideas?

olcConsoleGameEngineSDL.h: In member function ‘bool olcSprite::Save(std::wstring)’:
olcConsoleGameEngineSDL.h:383:66: error: no matching function for call to ‘std::basic_ofstream::basic_ofstream(const wchar_t*, std::_Ios_Openmode)’
383 | std::ofstream f(sFile.c_str(), std::ios::out | std::ios::binary);
| ^
In file included from olcConsoleGameEngineSDL.h:141,
from OneLoneCoder_Asteroids_linux.cpp:64:
/usr/include/c++/9/fstream:850:7: note: candidate: ‘std::basic_ofstream<_CharT, _Traits>::basic_ofstream(std::basic_ofstream<_CharT, _Traits>&&) [with _CharT = char; _Traits = std::char_traits]’
850 | basic_ofstream(basic_ofstream&& __rhs)
| ^~~~~~~~~~~~~~
/usr/include/c++/9/fstream:850:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/9/fstream:825:7: note: candidate: ‘std::basic_ofstream<_CharT, _Traits>::basic_ofstream(const string&, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits; std::string = std::__cxx11::basic_string; std::ios_base::openmode = std::_Ios_Openmode]’
825 | basic_ofstream(const std::string& __s,
| ^~~~~~~~~~~~~~
/usr/include/c++/9/fstream:825:41: note: no known conversion for argument 1 from ‘const wchar_t*’ to ‘const string&’ {aka ‘const std::__cxx11::basic_string&’}
825 | basic_ofstream(const std::string& __s,
| ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/9/fstream:790:7: note: candidate: ‘std::basic_ofstream<_CharT, _Traits>::basic_ofstream(const char*, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits; std::ios_base::openmode = std::_Ios_Openmode]’
790 | basic_ofstream(const char* __s,
| ^~~~~~~~~~~~~~
/usr/include/c++/9/fstream:790:34: note: no known conversion for argument 1 from ‘const wchar_t*’ to ‘const char*’
790 | basic_ofstream(const char* __s,
| ~~~~~~~~~~~~^~~
/usr/include/c++/9/fstream:779:7: note: candidate: ‘std::basic_ofstream<_CharT, _Traits>::basic_ofstream() [with _CharT = char; _Traits = std::char_traits]’
779 | basic_ofstream(): __ostream_type(), _M_filebuf()
| ^~~~~~~~~~~~~~
/usr/include/c++/9/fstream:779:7: note: candidate expects 0 arguments, 2 provided
In file included from OneLoneCoder_Asteroids_linux.cpp:64:
olcConsoleGameEngineSDL.h: In member function ‘bool olcSprite::Load(std::wstring)’:
olcConsoleGameEngineSDL.h:409:65: error: no matching function for call to ‘std::basic_ifstream::basic_ifstream(const wchar_t*, std::_Ios_Openmode)’
409 | std::ifstream f(sFile.c_str(), std::ios::in | std::ios::binary);
| ^
In file included from olcConsoleGameEngineSDL.h:141,
from OneLoneCoder_Asteroids_linux.cpp:64:
/usr/include/c++/9/fstream:587:7: note: candidate: ‘std::basic_ifstream<_CharT, _Traits>::basic_ifstream(std::basic_ifstream<_CharT, _Traits>&&) [with _CharT = char; _Traits = std::char_traits]’
587 | basic_ifstream(basic_ifstream&& __rhs)
| ^~~~~~~~~~~~~~
/usr/include/c++/9/fstream:587:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/9/fstream:562:7: note: candidate: ‘std::basic_ifstream<_CharT, _Traits>::basic_ifstream(const string&, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits; std::string = std::__cxx11::basic_string; std::ios_base::openmode = std::_Ios_Openmode]’
562 | basic_ifstream(const std::string& __s,
| ^~~~~~~~~~~~~~
/usr/include/c++/9/fstream:562:41: note: no known conversion for argument 1 from ‘const wchar_t*’ to ‘const string&’ {aka ‘const std::__cxx11::basic_string&’}
562 | basic_ifstream(const std::string& __s,
| ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/9/fstream:529:7: note: candidate: ‘std::basic_ifstream<_CharT, _Traits>::basic_ifstream(const char*, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits; std::ios_base::openmode = std::_Ios_Openmode]’
529 | basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in)
| ^~~~~~~~~~~~~~
/usr/include/c++/9/fstream:529:34: note: no known conversion for argument 1 from ‘const wchar_t*’ to ‘const char*’
529 | basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in)
| ~~~~~~~~~~~~^~~
/usr/include/c++/9/fstream:518:7: note: candidate: ‘std::basic_ifstream<_CharT, _Traits>::basic_ifstream() [with _CharT = char; _Traits = std::char_traits]’
518 | basic_ifstream() : __istream_type(), _M_filebuf()
| ^~~~~~~~~~~~~~
/usr/include/c++/9/fstream:518:7: note: candidate expects 0 arguments, 2 provided
In file included from OneLoneCoder_Asteroids_linux.cpp:64:
olcConsoleGameEngineSDL.h: In member function ‘void olcConsoleGameEngine::GameThread()’:
olcConsoleGameEngineSDL.h:928:70: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 209 [-Wformat-truncation=]
928 | snprintf(s, 256, "OneLoneCoder.com - Console Game Engine (SDL) - %s - FPS: %3.2f", bufAppName, 1.0f / fElapsedTime);
| ^~ ~~~~~~~~~~
olcConsoleGameEngineSDL.h:928:22: note: assuming directive output of 4 bytes
928 | snprintf(s, 256, "OneLoneCoder.com - Console Game Engine (SDL) - %s - FPS: %3.2f", bufAppName, 1.0f / fElapsedTime);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
olcConsoleGameEngineSDL.h:928:13: note: ‘snprintf’ output between 59 and 624 bytes into a destination of size 256
928 | snprintf(s, 256, "OneLoneCoder.com - Console Game Engine (SDL) - %s - FPS: %3.2f", bufAppName, 1.0f / fElapsedTime);
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:59: OneLoneCoder_Asteroids] Error 1

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants