Download

Advice for building C++ on macOS. Some of my code relies on C++03. Some relies on C++11

This isn’t related to UE4. I am trying to build UE3 to run on OSX and macOS. I have everything ready to go. Basically, I have a Mac networked with my Windows development machine. The Mac runs a tool that listens on a certain port, and when I start the Unreal Build Tool on my Windows machine, it runs a command on the Mac, using clang to kick off the C++ build of UE3.

That is working so far. But now I’m running into some problems and I’m not sure how to fix them, and maybe one of you with some C++ experience and macOS experience can tell me how to proceed.

The problem is this: The UE3 code is absolutely full to the brim with string literals being converted to wchar_t. That was still allowed in C++03, but it’s no longer allowed in C++11. So I figured out how to force clang to build in C++98 (which if I understand correctly clang’s C++98 includes updates from 03?), and now all of the code’s references to nullptr are broken because nullptr was introduced in C++11.

I think most or all of the nullptr references are in Steamworks, and not in UE3 itself (but don’t quote me on that). I already rewrote much of UE3’s Steamworks code to work with the latest Steamworks API (lots of qwords now where UE3’s default 32-bit dword ints used to be). And it compiles fine on Windows. Apparently the Visual C++ compiler is forgiving enough to let me convert string literals and use nullptr at the same time. But now what’s the best way for me to try to do this for Mac?

Is there a way to make clang mix C++ standards? Maybe I can compile in C++11 but still allow strings to wchar_t? Or can I compile for C++03 and still have the compiler understand nullptr? Would I have to write a header that defines nullptr and include that header everywhere there’s a nullptr? Or is there some way to convert strings to wchar_t in C++11 that I could find/replace throughout all the code?

[Edit: Actually, I think I need it to stay in C++98/03. There’s a bunch of other stuff that breaks in C++11. I’m pretty sure it’ll be easier for me to fix nullptr in C++03 than to fix all the rest of UE3 to work in C++11.]

I’m really not a C++ expert. I really feel like I’m in over my head now and it’s kind of miraculous that I’ve come this far. So if you have any ideas for me, please explain it using small words. Thanks.