error C2143 Error de definition de variables
bonjour a tous
bon , ben , je pense que le titre est assé explicite et parle à tout le monde
voici donc la partie du code fautive :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
#ifndef CLASS_WEAPON
#define CLASS_WEAPON
#include "stdafx.h"
#include "character.h"
#include "Missile.h"
using namespace System;
using namespace System::Collections;
using namespace System::Collections::Generic;
using namespace Microsoft::Xna::Framework;
using namespace Microsoft::Xna::Framework::Content;
using namespace Microsoft::Xna::Framework::Graphics;
using namespace Microsoft::Xna::Framework::Input;
ref class Weapon
{
private:
int Damage;
String ^Name;
int Number;
bool Status;
Vector2 ^Position;
ArrayList ^Munitions;
Vector2 ^InitialPosition;
character ^Owner; /*<<<<< le compilateur me designe cette ligne*/
public:
///<summary>
///Weapon constructor
///<summary>
Weapon(int number,Microsoft::Xna::Framework::Vector2 ^_Position); |
je vous épargne le header complet
voila donc la premiere partie ( vous allez comprendre )
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
#ifndef CLASS_CHARACTER
#define CLASS_CHARACTER
#include "stdafx.h"
#include "MObject.h"
#include "Weapon.h"
using namespace System;
using namespace System::Collections;
using namespace System::Collections::Generic;
using namespace Microsoft::Xna::Framework;
using namespace Microsoft::Xna::Framework::Content;
using namespace Microsoft::Xna::Framework::Graphics;
using namespace Microsoft::Xna::Framework::Input;
ref class character : MObject
{
private:
///<summary>
/// health of the character
///</summary>
int Health;
///<summary>
///weapon of the character
///</summary>
Weapon ^ Weap; /*<<<<< le compilateur me designe cette ligne*/
///<summary>
///Aim angle of the character
///</summary>
float Angle;
///<summary>
///Position of the character
///</summary>
Vector2 ^ Position;
public :
///<summary>
///constructor of character
///<param name="Health"> The health of the character</param>
///<param name="PositionX"> The X position of the character</param>
///<param name="PositionY"> The Y position of the character</param>
///</summary>
character::character(int _Health,float PositionX,float PositionY,Weapon ^_Weapon); |
et voici donc l'autre header .
bon , comme on peut le voir , il y a un appel récursif , mais l'erreur ne vient pas de la ( j'ai deja testé )
et voici donc le message d'erreur que me sort Visual
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
1>Compiling...
1>Weapon.cpp
1>d:\dossier seconde année espagne\goip\goip\goip\character.h(28) : error C2143: syntax error : missing ';' before '^'
1>d:\dossier seconde année espagne\goip\goip\goip\character.h(28) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\dossier seconde année espagne\goip\goip\goip\character.h(28) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\dossier seconde année espagne\goip\goip\goip\character.h(45) : error C2061: syntax error : identifier 'Weapon'
1>character.cpp
1>d:\dossier seconde année espagne\goip\goip\goip\Weapon.h(25) : error C2143: syntax error : missing ';' before '^'
1>d:\dossier seconde année espagne\goip\goip\goip\Weapon.h(25) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\dossier seconde année espagne\goip\goip\goip\Weapon.h(25) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>Generating Code...
1>Build log was saved at "file://d:\dossier seconde année espagne\GOIP\Goip\Goip\Debug\BuildLog.htm"
1>Goip - 7 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== |
voila donc mon probleme , merci a tous pour votre aide ( meme maigre :roll: )