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

MorphOS and AmigaOS4 build fix #1682

Closed
wants to merge 0 commits into from

Conversation

@BSzili
Copy link
Contributor

commented Mar 10, 2019

I adjusted the Makefile for the latest OS4 compiler that needs some extra flags for the C++11 threads. I had to add a hack to implement to_string, I'm not sure if system.h is the right place for it, but it's used in quite a few places.

@Ghabry

This comment has been minimized.

Copy link
Member

commented Mar 10, 2019

So there are still platforms that dont implement to_string, how unfortunate.
Not tested but another way which allows keeping the definition out of system.h is:

  1. Create a file "string" in the amiga folder
  2. Add the amiga folder as an include dir
  3. Put the stuff you added to system.h into "string":
INCLUDE_GUARD

#include_next <string>

#include <sstream> 
namespace std { 
	template <typename T> string to_string(const T &n) { 
		ostringstream strm; 
		strm << n; 
		return strm.str(); 
	} 
}

END INCLUDE_GUARD

Include_next is a GNU extension that includes the next header with this name, which is the system header and all Player code will include this file first and get std::to_string this way.

Sometimes std::to_string is already available but needs -D_GLIBCXX_USE_C99

@fmatthew5876

This comment has been minimized.

Copy link
Contributor

commented Mar 10, 2019

You can just call it string instead of string.h. Then a normal #include <string> in the code just works transparently. Once compilers upgrade, our fake string header can be removed and the code doesn't need to be changed,

I've done this #include_next trick before like that. Hacky but it works.

@Ghabry

This comment has been minimized.

Copy link
Member

commented Mar 10, 2019

yes that was a typo, I meant "string", not "string.h". thx

@fdelapena fdelapena added the Building label Mar 10, 2019

@BSzili

This comment has been minimized.

Copy link
Contributor Author

commented Mar 10, 2019

Mea culpa, I should have checked the C++ headers before copying the workaround I found on the forums. _GLIBCXX_USE_C99_STDIO and _GLIBCXX_USE_C99 did the trick.

@carstene1ns
Copy link
Member

left a comment

Looks good to me, let's squash and merge.


Sorry for breaking zoom in 0.6.0. 😌

@Ghabry

This comment has been minimized.

Copy link
Member

commented Mar 10, 2019

I approve but can't squash merge on mobile GitHub ^^'

@carstene1ns

This comment has been minimized.

Copy link
Member

commented Mar 10, 2019

Sorry, git took my master branch instead of yours when force-pushing.
(would have needed to add a different refspec)

@carstene1ns carstene1ns added this to the 0.6.1 milestone Mar 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.