'system' was not declared in this scope

Asked by MattWilson

Installing qtstalker-0.36 from source works in 8.04 but fails in 8.10. During 'make', get several error messages. Example of message is "UpgradeMessage.cpp: 447: error: 'system' was not declared in this scope'". The messages are caused by the use of "system(s)" in the source code, where "s" is a bash command as a string - obviously expecting the command the be executed at the OS level. Is there a change to the scoping rules for C++, a bug in the compiler, or is the source code just a bit short on compliance now?

To get the compiler, I used Synaptic Package Manager to get build-essential, accepting all the dependent packages. I do not know how to check what the differences are between the dependencies on build-essential for 8.04 and for 8.10. Advice welcome. What else can I check?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu gcc-4.3 Edit question
Assignee:
No assignee Edit question
Solved by:
MattWilson
Solved:
Last query:
Last reply:
Revision history for this message
MattWilson (matt2b) said :
#1

The list in build-essential does not have g++ (as I had expected), so what causes that package to load?

For 8.10, '> g++ -dumpversion' = 4.3.2; I don't have 8.04 available just now to check its version of g++. But a check on http://packages.ubuntu.com/hardy/g++ says 4.2.3-1 (compared to http://packages.ubuntu.com/intrepid/g++ which has 4.3.1-1). Changelogs didn't enlighten me, but some entries are too cryptic for me ('cos I do not understand the ramifications!). In a few hours, I'll have a go at regressing g++ back! Any other ideas welcome.

Revision history for this message
MattWilson (matt2b) said :
#2

Regressing g++ is too hard for me!! Too many dependencies!!! Maybe I could start with 8.04 and just put in the new build-essential & g++. Bit busy for a day or two, and maybe someone has a better idea in the meantime.

Revision history for this message
Arnaudus (a-lerouzic) said :
#3

Perhaps it is a stupid question, but why are you trying to compile a soft that is provided as a package for Ubuntu? Are the differences between versions 0.32 and 0.36 large enough? Compiling a soft can be tricky, that's exactly why Ubuntu provides already compiled packages!

You can install older versions of g++: g++-3.1 and g++-4.1 are provided in the default repositories. Otherwise, there are many options in gcc to change the behavior of the compiler. In any case, you should advice the developers of qtstalker to check for the version of the compiler in the configure script, since compilation fails if g++ is too recent.

Revision history for this message
MattWilson (matt2b) said :
#4

No questions are stupid: and the indicator generation is very different between qtstalker 0.32 and 0.36. I could probably rebuild most of my new indicators in the old qtstalker, but... well... not all of them and, anyway, I think going forward is better. I wanted a bit more indicator-building capability than was in qtstalker 0.32, and I found there was a newer version available. I compiled qtstalker 0.36 on ubuntu 8.04 without a hitch; my first compiles on ubuntu!! It seemed to be sensible to check the new ubuntu when it came out, so I tried the compile on it.

So, why is there such a difference in g++ from 4.2.3 to 4.3.2? It seems to me that a compiler should not break over such a minor version step; new features, yes, but still do what it used to do. Ah! but one can argue that it is just another soft, and if the developers of qtstalker can make a radical change so can the developers of g++. Personally, I disagree with that perspective, if only because of the dependencies.

I've just figured out how to have both versions of the compiler, and use the older one. Doh! (i.e. install older compiler, then just redo the link for g++). I'll give this a go next, but that means I need to reboot this machine into ubuntu 8.10. Back soon with update.

Revision history for this message
MattWilson (matt2b) said :
#5

Using g++-4.2 works. But g++-4.3 does not. So now I have my problem solved (using that workaround). I'll let the qtstalker developers know. If any g++ support person reads this, have a look at what changed from g++4.2 to g++4.3.

Revision history for this message
Vitaly (selivanov) said :
#6

g++ 4.3 should work if you include on the top of sourse c++ file:

#include <cstdlib>

Revision history for this message
Max (maxmax) said :
#7

Confirmed.
Adding "#include <cstdlib>" to "lib/UpgradeMessage.cpp" works perfect.