You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unable to compile the simulator as is using updated gcc packages due to syntax errors.
System Information
Ubuntu 18.04 LTS
GCC 7.3.0
GNU Make 4.1
How do we replicate the issue/how would it work?
Clone a fresh version and run make with a newest gcc compiler on a new machine. Five occurrences of const variables have to be changed to constexpr in order for the code to compile.
/** * Default value of Aconst.*/staticconst BGFLOAT DEFAULT_a = 0.0035;
/** * Default value of Bconst.*/staticconst BGFLOAT DEFAULT_b = 0.2;
/** * Default value of Cconst.*/staticconst BGFLOAT DEFAULT_c = -50;
/** * Default value of Dconst.*/staticconst BGFLOAT DEFAULT_d = 2;
-to-
/** * Default value of Aconst.*/staticconstexpr BGFLOAT DEFAULT_a = 0.0035;
/** * Default value of Bconst.*/staticconstexpr BGFLOAT DEFAULT_b = 0.2;
/** * Default value of Cconst.*/staticconstexpr BGFLOAT DEFAULT_c = -50;
/** * Default value of Dconst.*/staticconstexpr BGFLOAT DEFAULT_d = 2;
Expected behavior (i.e. solution or outline of what it would look like)
Running make or make growth succsesfully compiles.
Other Comments
In the research I did, it seems to be a difference in standards between c++98 and c++11. There is a fix in stack overflow involving macros by detecting the GNU compiler version. I tried to force make to compile at an older version of the GCC and to the c++98 standard to no avail. In the end I changed the syntax and it compiled succsesfully.
error: 'constexpr' needed for in-class initialzation of static data member 'const float AllSynapses::SYNAPSE_STRENGTH_ADJUSTMENT' of non-integral type [-fpermissive]
static const BGFLOAT SYNAPSE_STRENGTH_ADJUSTMENT = 1.0e-8;
The text was updated successfully, but these errors were encountered:
-std=c++98
Does compile growth with a good number of warnings.
Did not test make growth_cuda
This is a 20 year old standard... I don't know if I would calll this a fix.
-std=c++11 & -std=c++11 -pedantic
Fail, same error
I think that the age of the C++ 1998 standard isn't really a problem. Actually, as far as I can think of right now, this is just about the only situation in which there was a subsequent change that breaks perfectly good earlier code. Most other changes are either "nice additions" or "extensions that people have differences of opinion on" (a good example of the latter being the auto specifier in variable declarations, which some people feel is good and others feel allows programmers to ignore issues associated with variable types that can bite them later).
I'm not 100% up to speed on constexpr vs. const, but it appears to me that constexpr is intended for much more complex situations than we are involved with. In this particular case, I think we need to understand what's going on first and then decide how we want to change our code.
The warnings have been there for a while; they are in the backlog, associated with improving code quality.
OK, I am going to "fix" this by adding -std=c++98 to CXXFLAGS in the Makefile. I will also create a new issue to go through the code and bring it into compliance with C++11 as a general policy (I'll refer to this issue in that one).
What kind of issue is this?
What is affected by this?
Unable to compile the simulator as is using updated gcc packages due to syntax errors.
System Information
Ubuntu 18.04 LTS
GCC 7.3.0
GNU Make 4.1
How do we replicate the issue/how would it work?
Clone a fresh version and run make with a newest gcc compiler on a new machine. Five occurrences of
const
variables have to be changed toconstexpr
in order for the code to compile.In AllSynapses.h
Change
-to-
In AllZHNeurons.h
Change
-to-
Expected behavior (i.e. solution or outline of what it would look like)
Running
make
ormake growth
succsesfully compiles.Other Comments
In the research I did, it seems to be a difference in standards between c++98 and c++11. There is a fix in stack overflow involving macros by detecting the GNU compiler version. I tried to force
make
to compile at an older version of the GCC and to the c++98 standard to no avail. In the end I changed the syntax and it compiled succsesfully.The text was updated successfully, but these errors were encountered: