TTimo / GtkRadiant

The open source, cross platform level editor for idtech games
http://icculus.org/gtkradiant/
Other
581 stars 152 forks source link

error: ‘nullptr’ was not declared in this scope #693

Open nuxy opened 7 months ago

nuxy commented 7 months ago

Building this package on a Ubuntu 22.04 system results with the compilation error:

radiant/main.cpp: In function ‘int mainRadiant(int, char**)’:
radiant/main.cpp:500:25: error: ‘nullptr’ was not declared in this scope
  if ( xdg_state_home != nullptr ) {
                         ^
radiant/main.cpp:515:24: error: ‘nullptr’ was not declared in this scope
  if ( xdg_data_home != nullptr ) {
                        ^
radiant/main.cpp:403:21: warning: ignoring return value of ‘int seteuid(__uid_t)’, declared with attribute warn_unused_result [-Wunused-result]
  seteuid( getuid() );
                     ^
radiant/main.cpp:405:23: warning: ignoring return value of ‘int setuid(__uid_t)’, declared with attribute warn_unused_result [-Wunused-result]
   setuid( pw->pw_uid );
                       ^
radiant/main.cpp: In function ‘void RunBsp(char*)’:
radiant/main.cpp:1196:25: warning: ignoring return value of ‘int pipe(int*)’, declared with attribute warn_unused_result [-Wunused-result]
   pipe( process->pipes );
                         ^
scons: *** [build/release/radiant/radiant/main.o] Error 1
scons: building terminated because of errors.

This error can be overcome by applying the following config.py patch below:

--- config.py   2023-11-13 00:50:45.273801210 +0000
+++ config.py   2023-11-13 00:51:16.733927700 +0000
@@ -257,7 +257,7 @@
                 env.ParseConfig( 'pkg-config zlib --cflags --libs' )

         env.Append( CCFLAGS = baseflags )
-        env.Append( CXXFLAGS = baseflags + [ '-fpermissive', '-fvisibility-inlines-hidden' ] )
+        env.Append( CXXFLAGS = baseflags + [ '-fpermissive', '-fvisibility-inlines-hidden', '-std=c++11' ] )
         env.Append( CPPPATH = [ 'include', 'libs' ] )
         env.Append( CPPDEFINES = [ 'Q_NO_STLPORT' ] )
         if ( config == 'debug' ):

I have only tested my specific case, hence the reason for not submitting this as a PR

Hope this helps.

MatiasRepetto commented 6 months ago

Yeah, this is the way i resolved the issue too, adding c++11, sould be a rasonable PR i think.