[sclug] g++ c++ question
Tim Sutton
t.sutton at reading.ac.uk
Sat Oct 25 09:05:53 UTC 2003
Hi
I am working on the same code both at home and at work. Home computer running
a modified copy of knoppix, work computer running debian woody with unstable
updates.
My project compiles fine at home and on a wind###s pc here at work running
bloodshed dev-cpp (basically g++ based), but at work I get :
dataprocessor.cpp:780: error: ISO C++ forbids variable-size array `
The offending code snippet looks like this:
int myArrayLengthInt = theClimateVector.size();
float myClimateArray[myArrayLengthInt];
I seem to have three g++'s on my desktop (the machne giving the compile
error)! :
aps02ts at appc61:~/public_html$ dpkg -l |grep g++
ii g++ 3.3.1-2 The GNU C++ compiler.
ii g++-2.95 2.95.4-17 The GNU C++ compiler.
ii g++-3.3 3.3.2-0pre3 The GNU C++ compiler
wheras on my home machine I have:
aps02ts at timlinux:~$ dpkg -l |grep g++
ii g++ 3.2.3-1 The GNU C++ compiler.
ii g++-3.2 3.2.3-6 The GNU C++ compiler
So I suppose the questions I have are:
-------------------------------------------------------
1) Did gcc / g++ 3.3 introduce some incompatiblility / stricter standards
checking that is affecting me?
2) Is there a way to turn this behaviou off in kdevelop / g++ ?
3) Failing 2), what do I need to do to get my code to conform? THe only
examples I was able to find on google involved creating an array of pointers
or somesuch - which will be unpleasant and involve a lot of rewriting for me
to do.
---------------------------------------------------------
Many thanks
Tim
--
Tim Sutton
BDWorld Middleware Programmer
-------------------------------------------------------------------
BiodiversityWorld Project
Centre for Plant Diversity & Systematics
School of Plant Sciences
The University of Reading
Reading, RG66AS, UK
Web : www.bdworld.org
Phone : +44-(0)118-378-6052
Email : t.sutton [at] reading.ac.uk
(email preferred method of correspondence)
-------------------------------------------------------------------
More information about the Sclug
mailing list