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

SP won't compile on C++14 #651

Closed
eezstreet opened this issue Mar 28, 2015 · 7 comments · Fixed by #658
Closed

SP won't compile on C++14 #651

eezstreet opened this issue Mar 28, 2015 · 7 comments · Fixed by #658
Labels

Comments

@eezstreet
Copy link
Contributor

Due to changes with string literals in C++14, the compile will fail.

error C3688: invalid literal suffix 'S_COLOR_GREY'; literal operator or literal operator template 'operator ""S_COLOR_GREY' not found cvar.cpp:1013

Here's a sample of one of the lines:
Com_Printf( S_COLOR_GREY"Bind "S_COLOR_WHITE"%s = "S_COLOR_GREY"\""S_COLOR_WHITE"%s"S_COLOR_GREY"\""S_COLOR_WHITE"\n", Key_KeynumToString( b ), kg.keys[b].binding );

@Razish
Copy link
Member

Razish commented Mar 29, 2015

This is the case in C++11 as-well.

@ensiform
Copy link
Member

And likely also applies to MP's version of the file too.

@Razish
Copy link
Member

Razish commented Mar 29, 2015

I'm sure I already fixed a bunch.

@smcv
Copy link
Contributor

smcv commented Apr 27, 2015

Due to a recent addition of #include <cstdint> (which is a C++11 feature) I'm now compiling with -std=gnu++11 (C++11 with GNU extensions) on gcc, leading to a similar issue there, although on gcc it's currently a warning rather than a hard error. I think #658 fixes all the instances of this, although there could be some left in MSVC- or Windows-specific code.

@ensiform
Copy link
Member

We require VS2010 to compile, therefore (c)stdint(.h) is included.

@smcv
Copy link
Contributor

smcv commented Apr 30, 2015

Specifically, smcv@5d2fd21 should fix most or all of this bug. I haven't tested MSVC, Windows or Mac builds, so I can't be sure that all instances are fixed, but the Linux build works (in g++'s C++11 mode) with that branch applied.

We require VS2010 to compile, therefore (c)stdint(.h) is included.

I'm not saying that MSVC doesn't have cstdint. However, Linux and Mac builds require either g++ or clang. g++ (gcc c++) does have cstdint, but in C++98 mode, it issues a compiler error if you use it. gcc in C++11 mode does allow using it (because cstdint is part of the C++11 standard), which is why I switched it into C++11 mode for #658.

If you would prefer that part of #658 to be fixed by changing #include <cstdint> to #include <stdint.h> instead of switching to C++11, I can do that. However, fixing the string concatenation syntax (this bug) seems like something that will eventually be necessary anyway, because future versions of MSVC and/or g++ will probably change their default C++ standards-compliance mode from C++98 to C++11 (or newer).

@smcv
Copy link
Contributor

smcv commented Apr 30, 2015

And likely also applies to MP's version of the file too.

You are correct, this applies to both SP and MP (but seemingly not JK2).

ensiform added a commit that referenced this issue Apr 30, 2015
It doesn't seem to be necessary right now.
Switched usage to `unsigned int` as it is in the JA MP version of the file.

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

Successfully merging a pull request may close this issue.

4 participants