"error: 'PI' was not declared in this scope"

Questions, problems and discussion about compiling FreeOrion.

Moderator: Oberlus

Post Reply
Message
Author
User avatar
bhelyer
Space Floater
Posts: 41
Joined: Tue Aug 28, 2007 3:51 am

"error: 'PI' was not declared in this scope"

#1 Post by bhelyer »

Okay, so I upgraded to Ubuntu 8.04 set up my tool-chain, and had some trouble compiling. So I uninstalled GiGi, cleaned the source tree, re-ran scons configure for GG and FO, and did a recompile. The compilation fails like so:

Code: Select all

g++ -o UI/TechTreeWnd-human.o -c -pthread -g -Wall -O2 -D_GNU_SOURCE=1 -D_REENTRANT -DNDEBUG -DFREEORION_LINUX -DENABLE_BINRELOC -DFREEORION_BUILD_HUMAN -DGL_GLEXT_PROTOTYPES -I/usr/include/python2.5 -I/usr/local/include -I/usr/include/SDL -I/usr/include/graphviz -Inetwork UI/TechTreeWnd.cpp
UI/TechTreeWnd.cpp: In function 'void<unnamed>::FillTheoryPanel(const GG::Rect&, int)':
UI/TechTreeWnd.cpp:99: error: 'PI' was not declared in this scope
UI/TechTreeWnd.cpp: In function 'void<unnamed>::FillApplicationPanel(const GG::Rect&, int)':
UI/TechTreeWnd.cpp:129: error: 'PI' was not declared in this scope
UI/TechTreeWnd.cpp: In function 'void<unnamed>::TraceTechPanelOutline(TechType, const GG::Rect&, const GG::Rect&, bool)':
UI/TechTreeWnd.cpp:214: error: 'PI' was not declared in this scope
UI/TechTreeWnd.cpp:238: error: 'PI' was not declared in this scope
UI/TechTreeWnd.cpp:255: error: 'PI' was not declared in this scope
UI/TechTreeWnd.cpp:273: error: 'PI' was not declared in this scope
UI/TechTreeWnd.cpp: In member function 'virtual void TechTreeWnd::TechNavigator::SectionHeaderControl::Render()':
UI/TechTreeWnd.cpp:1059: error: 'PI' was not declared in this scope
UI/TechTreeWnd.cpp: In member function 'void TechTreeWnd::LayoutPanel::Layout(bool, double)':
UI/TechTreeWnd.cpp:1787: warning: deprecated conversion from string constant to 'char*'
UI/TechTreeWnd.cpp:1795: warning: deprecated conversion from string constant to 'char*'
UI/TechTreeWnd.cpp:1795: warning: deprecated conversion from string constant to 'char*'
UI/TechTreeWnd.cpp:1796: warning: deprecated conversion from string constant to 'char*'
UI/TechTreeWnd.cpp:1796: warning: deprecated conversion from string constant to 'char*'
UI/TechTreeWnd.cpp:1797: warning: deprecated conversion from string constant to 'char*'
UI/TechTreeWnd.cpp:1798: warning: deprecated conversion from string constant to 'char*'
UI/TechTreeWnd.cpp:1799: warning: deprecated conversion from string constant to 'char*'
UI/TechTreeWnd.cpp:1799: warning: deprecated conversion from string constant to 'char*'
UI/TechTreeWnd.cpp:1800: warning: deprecated conversion from string constant to 'char*'
UI/TechTreeWnd.cpp:1800: warning: deprecated conversion from string constant to 'char*'
UI/TechTreeWnd.cpp:1803: warning: deprecated conversion from string constant to 'char*'
UI/TechTreeWnd.cpp:1803: warning: deprecated conversion from string constant to 'char*'
UI/TechTreeWnd.cpp:1804: warning: deprecated conversion from string constant to 'char*'
UI/TechTreeWnd.cpp:1804: warning: deprecated conversion from string constant to 'char*'
UI/TechTreeWnd.cpp:1805: warning: deprecated conversion from string constant to 'char*'
UI/TechTreeWnd.cpp:1806: warning: deprecated conversion from string constant to 'char*'
UI/TechTreeWnd.cpp:1809: warning: deprecated conversion from string constant to 'char*'
UI/TechTreeWnd.cpp:1809: warning: deprecated conversion from string constant to 'char*'
UI/TechTreeWnd.cpp:1832: warning: deprecated conversion from string constant to 'char*'
UI/TechTreeWnd.cpp:1841: error: 'PS2INCH' was not declared in this scope
UI/TechTreeWnd.cpp:1871: error: 'PS2INCH' was not declared in this scope
UI/TechTreeWnd.cpp: At global scope:
UI/TechTreeWnd.cpp:31: warning: '<unnamed>::temp_bool' defined but not used
I'm pretty sure I have all the libraries I need installed.

Code: Select all

$ gcc --version
gcc (GCC) 4.2.3 (Ubuntu 4.2.3-2ubuntu7)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ uname -a
Linux d600 2.6.24-12-generic #1 SMP Wed Mar 12 23:01:54 UTC 2008 i686 GNU/Linux

$ svn update

Fetching external item into 'GG'
External at revision 645.

At revision 2450.
Any ideas? I can't seem to keep this thing in a compiling state at the moment.

EDIT: Okay, so some snooping around graphviz shows that I can get it working like this:

Code: Select all

Index: UI/TechTreeWnd.cpp
===================================================================
--- UI/TechTreeWnd.cpp	(revision 2450)
+++ UI/TechTreeWnd.cpp	(working copy)
@@ -19,7 +19,11 @@
 #include <gvc.h>
 #include <boost/format.hpp>
 #include <algorithm>
+#include <geom.h>
+#include <arith.h>
 
+#define POINTS_PER_INCH	72
+#define PS2INCH(ps)		((ps)/(double)POINTS_PER_INCH)
 
 namespace {
     // command-line options
For some reason include <geom.h> wasn't enough to stop it asking for PS2INCH, so I had to copy the defines out. I'm definitely not saying this horrible hack should be commited, but this is what I had to do. I'm assuming it is because of a change in graphviz?

EDIT2:

Not that pertinent, but the upgrade to 8.04 (once I managed to get FO to compile :mrgreen:) or the latest revisions have eliminated all but one of my problems, the fonts are working, the planet screen is fast, the interface is (relatively) glitch free. The only remaining problem is that I still don't get the big title pic at the menu screen. But the FreeOrion logo comes up now. This should incline me more towards working on it now, hopefully.

I also see that others have had the same problem. It's going to get harder to say use a different graphviz at this point I suspect, as people running Ubuntu (and I suspect the latest Debian) will run into this problem as they upgrade.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13603
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: "error: 'PI' was not declared in this scope"

#2 Post by Geoff the Medio »

A previous thread discussed this issue, in case the original poster or anyone else has this issue again...

viewtopic.php?f=24&t=1826

Maz
Space Floater
Posts: 22
Joined: Tue Jan 29, 2008 6:25 am

Re: "error: 'PI' was not declared in this scope"

#3 Post by Maz »

In my graphViz package PSINCH define was inside #ifdefs as follows:

#ifdef D_HAVE_CONFIG
#define PS.....
.
.
.
#endif

I have no idea what purpose the D_HAVE_CONFIG serves here? However the dirty hack I did was adding includes for other graphviz files as author of this thread did, and adding

#define D_HAVE_CONFIG

before including file where PSINCH was defined, and
#undef D_HAVE_CONFIG after it. I have no idea what kind of odd issues this may cause...

Post Reply