M
MyCatAlex
Guest
I have this chunk of C++ code, originally written under Ubuntu OS in Linux C++. Needless to say, It compiled and ran well.
using namespace std;
typedef std::complex<double> dcomp;
class LegendrePolynomials
{
public : void legendreTransform (int NN, //<== dcomp TotFourierTransf[], dcomp GaussLegTransf[])
{
int variant = 2; // variant is for Norm_selector.
double xxx[NN],www[NN]; // abscissas and weights
double theta,thetCosine,weight,ALP;
dcomp FourCoef,GaussFourCoef;
dcomp* p1 = (dcomp*)std::malloc(NN*NN*sizeof(dcomp));
dcomp* p2 = (dcomp*)std::malloc(NN*NN*sizeof(dcomp));
Now after I ported it to Windows 10 C++ I get this incredible error:
The error which is marked by a left looking arrow says "Expression must have a constant value. The value of parameter NN cannot be used as a constant."
I then defined the declaration for NN as const int NN and got a somewhat similar error.
What shall I do?
NN is also used in malloc command. Compiler ignored it, no error!
Thanks, - MyCatAlex
Continue reading...
using namespace std;
typedef std::complex<double> dcomp;
class LegendrePolynomials
{
public : void legendreTransform (int NN, //<== dcomp TotFourierTransf[], dcomp GaussLegTransf[])
{
int variant = 2; // variant is for Norm_selector.
double xxx[NN],www[NN]; // abscissas and weights
double theta,thetCosine,weight,ALP;
dcomp FourCoef,GaussFourCoef;
dcomp* p1 = (dcomp*)std::malloc(NN*NN*sizeof(dcomp));
dcomp* p2 = (dcomp*)std::malloc(NN*NN*sizeof(dcomp));
Now after I ported it to Windows 10 C++ I get this incredible error:
The error which is marked by a left looking arrow says "Expression must have a constant value. The value of parameter NN cannot be used as a constant."
I then defined the declaration for NN as const int NN and got a somewhat similar error.
What shall I do?
NN is also used in malloc command. Compiler ignored it, no error!
Thanks, - MyCatAlex
Continue reading...