instanciation de classe impossible c++/cli - C++ - Programmation
Marsh Posté le 13-12-2008 à 16:52:22
Slt, merci pour votre réponse mais ça marche toujours pas, voici les erreurs que me relève le compilateur :
------ Début de la génération : Projet : MonProjet, Configuration : Debug Win32 ------
Compilation en cours...
Form1.cpp
error C2871: 'MonProjet' : un espace de noms avec ce nom n'existe pas
error C2039: 'Matrice' : n'est pas membre de 'MonProjet'
error C2065: 'Matrice' : identificateur non déclaré
error C2146: erreur de syntaxe : absence de ';' avant l'identificateur 'm'
error C2065: 'm' : identificateur non déclaré
Marsh Posté le 13-12-2008 à 17:31:44
Est ce que quelqu'un pourrait me corriger ça SVP !!
J'ai créé un petit projet très basique, qui contient deux Forms, et j'ai commenté là où j'obtiens l'erreur (sur le Form2).
http://rapidshare.com/files/173021 [...] t.rar.html
Merci d'avance.
Marsh Posté le 14-12-2008 à 00:43:41
Merci de m'avoir répondu.
Je tiens à préciser que je débute en c++, et que j'ai déjà essayé ce que vous me proposez, c'est pour cette raison que j'ai poster mon application en pièce jointe, car je pense que le problème vient peut être de la manière par laquelle j'ai instancié mon objet.
Si quelqu'un a une autre soluce à me proposer je suis prenante.
Marsh Posté le 14-12-2008 à 10:42:34
Commence déjà par faire un programme beaucoup plus simple avec 3 fichiers, ensuite tu pourra y balancer des tes interfaces graphiques
Marsh Posté le 14-12-2008 à 15:43:19
Au fait mon problème venait d'une inclusion infinie que j'ai loupé.
Et Taz on parle pas pour ne rien dire, t'as même pas pris la peine de vérifier pour comprendre.
Marsh Posté le 14-12-2008 à 16:18:52
Euh je m'en cogne de ton C++ .Net. T'arrives pas à compiler un projet en 2/3 fichiers, c'est pas la peine de nous balancer du # private: System::Windows::Forms::Label^ label1;
# private: System::Windows::Forms::Panel^ panel1;
# private: System::Windows::Forms::Panel^ pan_sett;
#
# private: System::Windows::Forms::Timer^ timer1;
# private: System::Windows::Forms::Button^ button2;
# private: System::Windows::Forms::Button^ button1;
# private: System::Windows::Forms::Panel^ panel2;
# private: System::Windows::Forms::Button^ button3;
# private: System::Windows::Forms::Button^ button8;
# private: System::Windows::Forms::Button^ button7;
# private: System::Windows::Forms::Button^ button6;
# private: System::Windows::Forms::Button^ button5;
# private: System::Windows::Forms::Button^ button4;
# private: System::Windows::Forms::Button^ button12;
# private: System::Windows::Forms::Button^ button11;
# private: System::Windows::Forms::Button^ button10;
# private: System::Windows::Forms::Button^ button9;
# private: System::Windows::Forms::Label^ label2;
# private: System::Windows::Forms::Label^ label4;
# private: System::Windows::Forms::Label^ label3;
#
#
# private: System::Windows::Forms::Label^ label6;
# private: System::Windows::Forms::Label^ label8;
# private: System::Windows::Forms::Label^ label7;
#
#
#
#
#
#
#
# private: System::Windows::Forms::Label^ label5;
# private: System::Windows::Forms::Button^ button14;
# private: System::Windows::Forms::Button^ button13;
# private: System::Windows::Forms::Button^ button15;
#
# private: System::ComponentModel::IContainer^ components;
# protected:
# private: System::Windows::Forms::Label^ label1;
# private: System::Windows::Forms::Panel^ panel1;
# private: System::Windows::Forms::Panel^ pan_sett;
#
# private: System::Windows::Forms::Timer^ timer1;
# private: System::Windows::Forms::Button^ button2;
# private: System::Windows::Forms::Button^ button1;
# private: System::Windows::Forms::Panel^ panel2;
# private: System::Windows::Forms::Button^ button3;
# private: System::Windows::Forms::Button^ button8;
# private: System::Windows::Forms::Button^ button7;
# private: System::Windows::Forms::Button^ button6;
# private: System::Windows::Forms::Button^ button5;
# private: System::Windows::Forms::Button^ button4;
# private: System::Windows::Forms::Button^ button12;
# private: System::Windows::Forms::Button^ button11;
# private: System::Windows::Forms::Button^ button10;
# private: System::Windows::Forms::Button^ button9;
# private: System::Windows::Forms::Label^ label2;
# private: System::Windows::Forms::Label^ label4;
# private: System::Windows::Forms::Label^ label3;
#
#
# private: System::Windows::Forms::Label^ label6;
# private: System::Windows::Forms::Label^ label8;
# private: System::Windows::Forms::Label^ label7;
#
#
#
#
#
#
#
# private: System::Windows::Forms::Label^ label5;
# private: System::Windows::Forms::Button^ button14;
# private: System::Windows::Forms::Button^ button13;
# private: System::Windows::Forms::Button^ button15;
#
# private: System::ComponentModel::IContainer^ components;
# protected:
# private: System::Windows::Forms::Label^ label1;
# private: System::Windows::Forms::Panel^ panel1;
# private: System::Windows::Forms::Panel^ pan_sett;
#
# private: System::Windows::Forms::Timer^ timer1;
# private: System::Windows::Forms::Button^ button2;
# private: System::Windows::Forms::Button^ button1;
# private: System::Windows::Forms::Panel^ panel2;
# private: System::Windows::Forms::Button^ button3;
# private: System::Windows::Forms::Button^ button8;
# private: System::Windows::Forms::Button^ button7;
# private: System::Windows::Forms::Button^ button6;
# private: System::Windows::Forms::Button^ button5;
# private: System::Windows::Forms::Button^ button4;
# private: System::Windows::Forms::Button^ button12;
# private: System::Windows::Forms::Button^ button11;
# private: System::Windows::Forms::Button^ button10;
# private: System::Windows::Forms::Button^ button9;
# private: System::Windows::Forms::Label^ label2;
# private: System::Windows::Forms::Label^ label4;
# private: System::Windows::Forms::Label^ label3;
#
#
# private: System::Windows::Forms::Label^ label6;
# private: System::Windows::Forms::Label^ label8;
# private: System::Windows::Forms::Label^ label7;
#
#
#
#
#
#
#
# private: System::Windows::Forms::Label^ label5;
# private: System::Windows::Forms::Button^ button14;
# private: System::Windows::Forms::Button^ button13;
# private: System::Windows::Forms::Button^ button15;
#
# private: System::ComponentModel::IContainer^ components;
# protected:
# private: System::Windows::Forms::Label^ label1;
# private: System::Windows::Forms::Panel^ panel1;
# private: System::Windows::Forms::Panel^ pan_sett;
#
# private: System::Windows::Forms::Timer^ timer1;
# private: System::Windows::Forms::Button^ button2;
# private: System::Windows::Forms::Button^ button1;
# private: System::Windows::Forms::Panel^ panel2;
# private: System::Windows::Forms::Button^ button3;
# private: System::Windows::Forms::Button^ button8;
# private: System::Windows::Forms::Button^ button7;
# private: System::Windows::Forms::Button^ button6;
# private: System::Windows::Forms::Button^ button5;
# private: System::Windows::Forms::Button^ button4;
# private: System::Windows::Forms::Button^ button12;
# private: System::Windows::Forms::Button^ button11;
# private: System::Windows::Forms::Button^ button10;
# private: System::Windows::Forms::Button^ button9;
# private: System::Windows::Forms::Label^ label2;
# private: System::Windows::Forms::Label^ label4;
# private: System::Windows::Forms::Label^ label3;
#
#
# private: System::Windows::Forms::Label^ label6;
# private: System::Windows::Forms::Label^ label8;
# private: System::Windows::Forms::Label^ label7;
#
#
#
#
#
#
#
# private: System::Windows::Forms::Label^ label5;
# private: System::Windows::Forms::Button^ button14;
# private: System::Windows::Forms::Button^ button13;
# private: System::Windows::Forms::Button^ button15;
#
# private: System::ComponentModel::IContainer^ components;
# protected:
# private: System::Windows::Forms::Label^ label1;
# private: System::Windows::Forms::Panel^ panel1;
# private: System::Windows::Forms::Panel^ pan_sett;
#
# private: System::Windows::Forms::Timer^ timer1;
# private: System::Windows::Forms::Button^ button2;
# private: System::Windows::Forms::Button^ button1;
# private: System::Windows::Forms::Panel^ panel2;
# private: System::Windows::Forms::Button^ button3;
# private: System::Windows::Forms::Button^ button8;
# private: System::Windows::Forms::Button^ button7;
# private: System::Windows::Forms::Button^ button6;
# private: System::Windows::Forms::Button^ button5;
# private: System::Windows::Forms::Button^ button4;
# private: System::Windows::Forms::Button^ button12;
# private: System::Windows::Forms::Button^ button11;
# private: System::Windows::Forms::Button^ button10;
# private: System::Windows::Forms::Button^ button9;
# private: System::Windows::Forms::Label^ label2;
# private: System::Windows::Forms::Label^ label4;
# private: System::Windows::Forms::Label^ label3;
#
#
# private: System::Windows::Forms::Label^ label6;
# private: System::Windows::Forms::Label^ label8;
# private: System::Windows::Forms::Label^ label7;
#
#
#
#
#
#
#
# private: System::Windows::Forms::Label^ label5;
# private: System::Windows::Forms::Button^ button14;
# private: System::Windows::Forms::Button^ button13;
# private: System::Windows::Forms::Button^ button15;
#
# private: System::ComponentModel::IContainer^ components;
# protected:
# private: System::Windows::Forms::Label^ label1;
# private: System::Windows::Forms::Panel^ panel1;
# private: System::Windows::Forms::Panel^ pan_sett;
#
# private: System::Windows::Forms::Timer^ timer1;
# private: System::Windows::Forms::Button^ button2;
# private: System::Windows::Forms::Button^ button1;
# private: System::Windows::Forms::Panel^ panel2;
# private: System::Windows::Forms::Button^ button3;
# private: System::Windows::Forms::Button^ button8;
# private: System::Windows::Forms::Button^ button7;
# private: System::Windows::Forms::Button^ button6;
# private: System::Windows::Forms::Button^ button5;
# private: System::Windows::Forms::Button^ button4;
# private: System::Windows::Forms::Button^ button12;
# private: System::Windows::Forms::Button^ button11;
# private: System::Windows::Forms::Button^ button10;
# private: System::Windows::Forms::Button^ button9;
# private: System::Windows::Forms::Label^ label2;
# private: System::Windows::Forms::Label^ label4;
# private: System::Windows::Forms::Label^ label3;
#
#
# private: System::Windows::Forms::Label^ label6;
# private: System::Windows::Forms::Label^ label8;
# private: System::Windows::Forms::Label^ label7;
#
#
#
#
#
#
#
# private: System::Windows::Forms::Label^ label5;
# private: System::Windows::Forms::Button^ button14;
# private: System::Windows::Forms::Button^ button13;
# private: System::Windows::Forms::Button^ button15;
#
# private: System::ComponentModel::IContainer^ components;
# protected:
# private: System::Windows::Forms::Label^ label1;
# private: System::Windows::Forms::Panel^ panel1;
# private: System::Windows::Forms::Panel^ pan_sett;
#
# private: System::Windows::Forms::Timer^ timer1;
# private: System::Windows::Forms::Button^ button2;
# private: System::Windows::Forms::Button^ button1;
# private: System::Windows::Forms::Panel^ panel2;
# private: System::Windows::Forms::Button^ button3;
# private: System::Windows::Forms::Button^ button8;
# private: System::Windows::Forms::Button^ button7;
# private: System::Windows::Forms::Button^ button6;
# private: System::Windows::Forms::Button^ button5;
# private: System::Windows::Forms::Button^ button4;
# private: System::Windows::Forms::Button^ button12;
# private: System::Windows::Forms::Button^ button11;
# private: System::Windows::Forms::Button^ button10;
# private: System::Windows::Forms::Button^ button9;
# private: System::Windows::Forms::Label^ label2;
# private: System::Windows::Forms::Label^ label4;
# private: System::Windows::Forms::Label^ label3;
#
#
# private: System::Windows::Forms::Label^ label6;
# private: System::Windows::Forms::Label^ label8;
# private: System::Windows::Forms::Label^ label7;
#
#
#
#
#
#
#
# private: System::Windows::Forms::Label^ label5;
# private: System::Windows::Forms::Button^ button14;
# private: System::Windows::Forms::Button^ button13;
# private: System::Windows::Forms::Button^ button15;
#
# private: System::ComponentModel::IContainer^ components;
# protected:
# private: System::Windows::Forms::Label^ label1;
# private: System::Windows::Forms::Panel^ panel1;
# private: System::Windows::Forms::Panel^ pan_sett;
#
# private: System::Windows::Forms::Timer^ timer1;
# private: System::Windows::Forms::Button^ button2;
# private: System::Windows::Forms::Button^ button1;
# private: System::Windows::Forms::Panel^ panel2;
# private: System::Windows::Forms::Button^ button3;
# private: System::Windows::Forms::Button^ button8;
# private: System::Windows::Forms::Button^ button7;
# private: System::Windows::Forms::Button^ button6;
# private: System::Windows::Forms::Button^ button5;
# private: System::Windows::Forms::Button^ button4;
# private: System::Windows::Forms::Button^ button12;
# private: System::Windows::Forms::Button^ button11;
# private: System::Windows::Forms::Button^ button10;
# private: System::Windows::Forms::Button^ button9;
# private: System::Windows::Forms::Label^ label2;
# private: System::Windows::Forms::Label^ label4;
# private: System::Windows::Forms::Label^ label3;
#
#
# private: System::Windows::Forms::Label^ label6;
# private: System::Windows::Forms::Label^ label8;
# private: System::Windows::Forms::Label^ label7;
#
#
#
#
#
#
#
# private: System::Windows::Forms::Label^ label5;
# private: System::Windows::Forms::Button^ button14;
# private: System::Windows::Forms::Button^ button13;
# private: System::Windows::Forms::Button^ button15;
#
# private: System::ComponentModel::IContainer^ components;
# protected:
# private: System::Windows::Forms::Label^ label1;
# private: System::Windows::Forms::Panel^ panel1;
# private: System::Windows::Forms::Panel^ pan_sett;
#
# private: System::Windows::Forms::Timer^ timer1;
# private: System::Windows::Forms::Button^ button2;
# private: System::Windows::Forms::Button^ button1;
# private: System::Windows::Forms::Panel^ panel2;
# private: System::Windows::Forms::Button^ button3;
# private: System::Windows::Forms::Button^ button8;
# private: System::Windows::Forms::Button^ button7;
# private: System::Windows::Forms::Button^ button6;
# private: System::Windows::Forms::Button^ button5;
# private: System::Windows::Forms::Button^ button4;
# private: System::Windows::Forms::Button^ button12;
# private: System::Windows::Forms::Button^ button11;
# private: System::Windows::Forms::Button^ button10;
# private: System::Windows::Forms::Button^ button9;
# private: System::Windows::Forms::Label^ label2;
# private: System::Windows::Forms::Label^ label4;
# private: System::Windows::Forms::Label^ label3;
#
#
# private: System::Windows::Forms::Label^ label6;
# private: System::Windows::Forms::Label^ label8;
# private: System::Windows::Forms::Label^ label7;
#
#
#
#
#
#
#
# private: System::Windows::Forms::Label^ label5;
# private: System::Windows::Forms::Button^ button14;
# private: System::Windows::Forms::Button^ button13;
# private: System::Windows::Forms::Button^ button15;
#
# private: System::ComponentModel::IContainer^ components;
# protected:
# private: System::Windows::Forms::Label^ label1;
# private: System::Windows::Forms::Panel^ panel1;
# private: System::Windows::Forms::Panel^ pan_sett;
#
# private: System::Windows::Forms::Timer^ timer1;
# private: System::Windows::Forms::Button^ button2;
# private: System::Windows::Forms::Button^ button1;
# private: System::Windows::Forms::Panel^ panel2;
# private: System::Windows::Forms::Button^ button3;
# private: System::Windows::Forms::Button^ button8;
# private: System::Windows::Forms::Button^ button7;
# private: System::Windows::Forms::Button^ button6;
# private: System::Windows::Forms::Button^ button5;
# private: System::Windows::Forms::Button^ button4;
# private: System::Windows::Forms::Button^ button12;
# private: System::Windows::Forms::Button^ button11;
# private: System::Windows::Forms::Button^ button10;
# private: System::Windows::Forms::Button^ button9;
# private: System::Windows::Forms::Label^ label2;
# private: System::Windows::Forms::Label^ label4;
# private: System::Windows::Forms::Label^ label3;
#
#
# private: System::Windows::Forms::Label^ label6;
# private: System::Windows::Forms::Label^ label8;
# private: System::Windows::Forms::Label^ label7;
#
#
#
#
#
#
#
# private: System::Windows::Forms::Label^ label5;
# private: System::Windows::Forms::Button^ button14;
# private: System::Windows::Forms::Button^ button13;
# private: System::Windows::Forms::Button^ button15;
#
# private: System::ComponentModel::IContainer^ components;
# protected:
# private: System::Windows::Forms::Label^ label1;
# private: System::Windows::Forms::Panel^ panel1;
# private: System::Windows::Forms::Panel^ pan_sett;
#
# private: System::Windows::Forms::Timer^ timer1;
# private: System::Windows::Forms::Button^ button2;
# private: System::Windows::Forms::Button^ button1;
# private: System::Windows::Forms::Panel^ panel2;
# private: System::Windows::Forms::Button^ button3;
# private: System::Windows::Forms::Button^ button8;
# private: System::Windows::Forms::Button^ button7;
# private: System::Windows::Forms::Button^ button6;
# private: System::Windows::Forms::Button^ button5;
# private: System::Windows::Forms::Button^ button4;
# private: System::Windows::Forms::Button^ button12;
# private: System::Windows::Forms::Button^ button11;
# private: System::Windows::Forms::Button^ button10;
# private: System::Windows::Forms::Button^ button9;
# private: System::Windows::Forms::Label^ label2;
# private: System::Windows::Forms::Label^ label4;
# private: System::Windows::Forms::Label^ label3;
#
#
# private: System::Windows::Forms::Label^ label6;
# private: System::Windows::Forms::Label^ label8;
# private: System::Windows::Forms::Label^ label7;
#
#
#
#
#
#
#
# private: System::Windows::Forms::Label^ label5;
# private: System::Windows::Forms::Button^ button14;
# private: System::Windows::Forms::Button^ button13;
# private: System::Windows::Forms::Button^ button15;
#
# private: System::ComponentModel::IContainer^ components;
# protected:
# private: System::Windows::Forms::Label^ label1;
# private: System::Windows::Forms::Panel^ panel1;
# private: System::Windows::Forms::Panel^ pan_sett;
#
# private: System::Windows::Forms::Timer^ timer1;
# private: System::Windows::Forms::Button^ button2;
# private: System::Windows::Forms::Button^ button1;
# private: System::Windows::Forms::Panel^ panel2;
# private: System::Windows::Forms::Button^ button3;
# private: System::Windows::Forms::Button^ button8;
# private: System::Windows::Forms::Button^ button7;
# private: System::Windows::Forms::Button^ button6;
# private: System::Windows::Forms::Button^ button5;
# private: System::Windows::Forms::Button^ button4;
# private: System::Windows::Forms::Button^ button12;
# private: System::Windows::Forms::Button^ button11;
# private: System::Windows::Forms::Button^ button10;
# private: System::Windows::Forms::Button^ button9;
# private: System::Windows::Forms::Label^ label2;
# private: System::Windows::Forms::Label^ label4;
# private: System::Windows::Forms::Label^ label3;
#
#
# private: System::Windows::Forms::Label^ label6;
# private: System::Windows::Forms::Label^ label8;
# private: System::Windows::Forms::Label^ label7;
#
#
#
#
#
#
#
# private: System::Windows::Forms::Label^ label5;
# private: System::Windows::Forms::Button^ button14;
# private: System::Windows::Forms::Button^ button13;
# private: System::Windows::Forms::Button^ button15;
#
# private: System::ComponentModel::IContainer^ components;
# protected:
ça change rien au problème.
Marsh Posté le 14-12-2008 à 17:31:29
Il n'y a aucune honte à être débutant. Mais ce qui est bien ennuyeux c'est de trouver des gens qui se prennent pour des programmeurs nés.
D'ailleurs si je suis ici c'est pour avoir de l'aide et non pas pour me faire chambouler avec des interventions qui servent à rien.
Sujet clos.
Marsh Posté le 14-12-2008 à 17:43:55
Le choix du C++/CLI est quand même surprenant pour un débutant parce que c'est quand même un environnement chimérique complexe.
Le C# aurait été un choix plus pertinent.
Marsh Posté le 13-12-2008 à 14:49:35
Bonjour,
Je développe une application c++/cli via l'outil visual c++, auquel je ne suis pas très habituée. Et là je suis bloquée à une erreur que je comprends pas trop, et j'ai déjà presque tout tester mais rien n'y fais. Bref, j'ai deux class : Form1 et Matrice, qui ont le même namespace, le problème c'est que je n'arrive pas à accéder à la classe Matrice depuis From1, (les deux classes chacune dans un fichier).
Form1.h:
Form1.cpp :
Matrice.cpp:
Et merci.