je reçois l'erreurdemande de membre ... qui est de type non-classe
main.cpp: In function 'int main()':
main.cpp:43:16: error: request for member 'getF' in 'cor', which is of non-class type 'corMatrixFermion(MatrixV)'
myfile << cor.getF;
^
Voici l'en-tête de ma classe:
class MatrixV{
public:
MatrixV(std::string file);
MatrixV(Eigen::MatrixXd matrix);
MatrixV(double arr[], int arrsize);
Eigen::MatrixXd getV();
Eigen::VectorXd getSigma();
int getr();
Eigen::MatrixXd getO1();
Eigen::MatrixXd getO2();
Eigen::MatrixXd getE();
Eigen::MatrixXd getVStrich();
private:
int size;
Eigen::MatrixXd V;
Eigen::VectorXd Sigma;
int r;
Eigen::JacobiSVD<Eigen::MatrixXd, Eigen::NoQRPreconditioner> svd;
};
Et ici le main.cpp
int main(){
std::srand(time(0));
DataFromFile StartValues("StartValues");
double arr[4];
arr[0] = StartValues.get(1);
arr[1] = StartValues.get(2);
arr[2] = StartValues.get(3);
arr[3] = StartValues.get(4);
MatrixV V(arr, 4);
corMatrixFermion cor(MatrixV V);
std::ofstream myfile;
myfile.open ("corfunction.txt");
myfile << cor.getF();
myfile.close();
}
Il existe d'autres classes impliquées, mais je ne pense pas qu'elles causent le problème. Voyez-vous, ce que je fais mal? Si vous avez besoin de plus d'informations s'il vous plaît dites-moi. Il me semble que ce n'est pas l'habituel «demande de membre» -constructeur-problème. Mais peut-être que je me trompe ...
Vous avez posté la classe « MatrixV » mais pas « corMatrixFermion », est pas le problème avec le plus tard? – SPlatten
En plus du problème d'analyse, vous n'avez pas 'getF', mais un' getE'. Vote pour fermer comme une faute de frappe – StoryTeller
@StoryTeller 'getE' est dans une autre classe,' MatrixV'. La définition de 'corMatrixFermion' n'est pas montrée ici. – Thomas