16
Général / Une erreur de la SFML jamais compris
« le: Juillet 28, 2015, 12:22:15 pm »
Bonjour,
Defois j'ai des erreur avec la SFML que je ne comprend jamais defois avec un peut de chance j'arrive a enlever cette erreur mais la je n'y arrive pas
L'erreur est venus cette vois quand j'ai implémenter ma mitraillette
Mitraillette.cpp
Merci pour vos explication
Defois j'ai des erreur avec la SFML que je ne comprend jamais defois avec un peut de chance j'arrive a enlever cette erreur mais la je n'y arrive pas
L'erreur est venus cette vois quand j'ai implémenter ma mitraillette
Erreur 1 error LNK2005: "class Bullets bullets" (?bullets@@3VBullets@@A) déjà défini(e) dans Human.obj C:\Users\FamilleMazet\documents\visual studio 2013\Projects\Humain vs Alien\Humain vs Alien\Main.obj Humain vs Alien
Erreur 2 error LNK2005: "class Input input" (?input@@3VInput@@A) déjà défini(e) dans Human.obj C:\Users\FamilleMazet\documents\visual studio 2013\Projects\Humain vs Alien\Humain vs Alien\Main.obj Humain vs Alien
Erreur 3 error LNK2005: "class Map map" (?map@@3VMap@@A) déjà défini(e) dans Human.obj C:\Users\FamilleMazet\documents\visual studio 2013\Projects\Humain vs Alien\Humain vs Alien\Main.obj Humain vs Alien
Erreur 4 error LNK2005: "class Human human" (?human@@3VHuman@@A) déjà défini(e) dans Bullets.obj C:\Users\FamilleMazet\documents\visual studio 2013\Projects\Humain vs Alien\Humain vs Alien\Main.obj Humain vs Alien
Erreur 5 error LNK2005: "int bulletsSpeed" (?bulletsSpeed@@3HA) déjà défini(e) dans Human.obj C:\Users\FamilleMazet\documents\visual studio 2013\Projects\Humain vs Alien\Humain vs Alien\Mitraillette.obj Humain vs Alien
Erreur 6 error LNK2005: "class Bullets bullets" (?bullets@@3VBullets@@A) déjà défini(e) dans Human.obj C:\Users\FamilleMazet\documents\visual studio 2013\Projects\Humain vs Alien\Humain vs Alien\Mitraillette.obj Humain vs Alien
Erreur 7 error LNK2005: "class Input input" (?input@@3VInput@@A) déjà défini(e) dans Human.obj C:\Users\FamilleMazet\documents\visual studio 2013\Projects\Humain vs Alien\Humain vs Alien\Mitraillette.obj Humain vs Alien
Erreur 8 error LNK2005: "class Map map" (?map@@3VMap@@A) déjà défini(e) dans Human.obj C:\Users\FamilleMazet\documents\visual studio 2013\Projects\Humain vs Alien\Humain vs Alien\Mitraillette.obj Humain vs Alien
Erreur 9 error LNK2005: "class Human human" (?human@@3VHuman@@A) déjà défini(e) dans Bullets.obj C:\Users\FamilleMazet\documents\visual studio 2013\Projects\Humain vs Alien\Humain vs Alien\Mitraillette.obj Humain vs Alien
Erreur 10 error LNK1169: un ou plusieurs symboles définis à différentes reprises ont été rencontrés C:\Users\FamilleMazet\documents\visual studio 2013\Projects\Humain vs Alien\Release\Humain vs Alien.exe Humain vs Alien
Main.cppErreur 2 error LNK2005: "class Input input" (?input@@3VInput@@A) déjà défini(e) dans Human.obj C:\Users\FamilleMazet\documents\visual studio 2013\Projects\Humain vs Alien\Humain vs Alien\Main.obj Humain vs Alien
Erreur 3 error LNK2005: "class Map map" (?map@@3VMap@@A) déjà défini(e) dans Human.obj C:\Users\FamilleMazet\documents\visual studio 2013\Projects\Humain vs Alien\Humain vs Alien\Main.obj Humain vs Alien
Erreur 4 error LNK2005: "class Human human" (?human@@3VHuman@@A) déjà défini(e) dans Bullets.obj C:\Users\FamilleMazet\documents\visual studio 2013\Projects\Humain vs Alien\Humain vs Alien\Main.obj Humain vs Alien
Erreur 5 error LNK2005: "int bulletsSpeed" (?bulletsSpeed@@3HA) déjà défini(e) dans Human.obj C:\Users\FamilleMazet\documents\visual studio 2013\Projects\Humain vs Alien\Humain vs Alien\Mitraillette.obj Humain vs Alien
Erreur 6 error LNK2005: "class Bullets bullets" (?bullets@@3VBullets@@A) déjà défini(e) dans Human.obj C:\Users\FamilleMazet\documents\visual studio 2013\Projects\Humain vs Alien\Humain vs Alien\Mitraillette.obj Humain vs Alien
Erreur 7 error LNK2005: "class Input input" (?input@@3VInput@@A) déjà défini(e) dans Human.obj C:\Users\FamilleMazet\documents\visual studio 2013\Projects\Humain vs Alien\Humain vs Alien\Mitraillette.obj Humain vs Alien
Erreur 8 error LNK2005: "class Map map" (?map@@3VMap@@A) déjà défini(e) dans Human.obj C:\Users\FamilleMazet\documents\visual studio 2013\Projects\Humain vs Alien\Humain vs Alien\Mitraillette.obj Humain vs Alien
Erreur 9 error LNK2005: "class Human human" (?human@@3VHuman@@A) déjà défini(e) dans Bullets.obj C:\Users\FamilleMazet\documents\visual studio 2013\Projects\Humain vs Alien\Humain vs Alien\Mitraillette.obj Humain vs Alien
Erreur 10 error LNK1169: un ou plusieurs symboles définis à différentes reprises ont été rencontrés C:\Users\FamilleMazet\documents\visual studio 2013\Projects\Humain vs Alien\Release\Humain vs Alien.exe Humain vs Alien
#include <SFML\Graphics.hpp>
#include <iostream>
#include "Human.h"
#include "Input.h"
#include "Map.h"
#include "Bullets.h"
#include "Ennemy.h"
#include "Mitraillette.h"
using namespace std;
int main()
{
const int screenWidth = 800;
const int screenHeight = 480;
sf::RenderWindow window(sf::VideoMode(screenWidth, screenHeight, 32), "Human vs Alien v 2.0", sf::Style::Default);
window.setFramerateLimit(60);
Human human;
Input input;
Map map;
Bullets bullets;
Ennemy ennemy;
Mitraillette mitraillette;
human.init(map,false);
human.setLife(100);
map.setLevel(1);
map.changeLevel();
bullets.init(window, map);
ennemy.init(window);
mitraillette.init(window);
while (window.isOpen())
{
input.gestionInputs(window);
human.update(input,window);
window.clear();
map.drawBackground(window);
map.draw(2, window);
map.draw(1, window);
// Affiche le joueur
human.draw(window, map);
bullets.draw(window, map);
mitraillette.update(window);
ennemy.draw(window, map);
map.draw(3, window);
window.display();
}
return 0;
}
Mitraillette.h#include <iostream>
#include "Human.h"
#include "Input.h"
#include "Map.h"
#include "Bullets.h"
#include "Ennemy.h"
#include "Mitraillette.h"
using namespace std;
int main()
{
const int screenWidth = 800;
const int screenHeight = 480;
sf::RenderWindow window(sf::VideoMode(screenWidth, screenHeight, 32), "Human vs Alien v 2.0", sf::Style::Default);
window.setFramerateLimit(60);
Human human;
Input input;
Map map;
Bullets bullets;
Ennemy ennemy;
Mitraillette mitraillette;
human.init(map,false);
human.setLife(100);
map.setLevel(1);
map.changeLevel();
bullets.init(window, map);
ennemy.init(window);
mitraillette.init(window);
while (window.isOpen())
{
input.gestionInputs(window);
human.update(input,window);
window.clear();
map.drawBackground(window);
map.draw(2, window);
map.draw(1, window);
// Affiche le joueur
human.draw(window, map);
bullets.draw(window, map);
mitraillette.update(window);
ennemy.draw(window, map);
map.draw(3, window);
window.display();
}
return 0;
}
#ifndef MITRAILLETTE_H
#define MITRAILLETTE_H
#include <SFML\Graphics.hpp>
#include "Human.h"
#include "Bullets.h"
#include "Input.h"
#include "Map.h"
Human human;
Bullets bullets;
Input input;
Map map;
class Mitraillette
{
public:
Mitraillette();
// Mutateur
void Mitraillette::setMunition(int valeur);
void Mitraillette::setRecharge(int valeur);
void Mitraillette::setX(int valeur);
void Mitraillette::setY(int valeur);
//Accesseur
int Mitraillette::getMunition(void) const;
int Mitraillette::getRecharge(void) const;
int Mitraillette::getX(void) const;
int Mitraillette::getY(void) const;
// Fonction
void Mitraillette::init(sf::RenderWindow &window);
void Mitraillette::update(sf::RenderWindow &window);
private:
int munition;
int recharge;
int x, y;
int direction, etat;
enum { bulletU, BulletD, BulletL, BulletR };
enum { ARRET, AVANCE };
};
#endif // !MITRAILLETTE_H
#define MITRAILLETTE_H
#include <SFML\Graphics.hpp>
#include "Human.h"
#include "Bullets.h"
#include "Input.h"
#include "Map.h"
Human human;
Bullets bullets;
Input input;
Map map;
class Mitraillette
{
public:
Mitraillette();
// Mutateur
void Mitraillette::setMunition(int valeur);
void Mitraillette::setRecharge(int valeur);
void Mitraillette::setX(int valeur);
void Mitraillette::setY(int valeur);
//Accesseur
int Mitraillette::getMunition(void) const;
int Mitraillette::getRecharge(void) const;
int Mitraillette::getX(void) const;
int Mitraillette::getY(void) const;
// Fonction
void Mitraillette::init(sf::RenderWindow &window);
void Mitraillette::update(sf::RenderWindow &window);
private:
int munition;
int recharge;
int x, y;
int direction, etat;
enum { bulletU, BulletD, BulletL, BulletR };
enum { ARRET, AVANCE };
};
#endif // !MITRAILLETTE_H
Mitraillette.cpp
#include "Mitraillette.h"
int humanPosX = human.getX();
int humanPosY = human.getY();
int bulletsSpeed = bullets.getSpeed();
Mitraillette::Mitraillette()
{
x, y;
munition;
recharge;
etat, direction;
}
// Accesseur
int Mitraillette::getX(void) const { return x; }
int Mitraillette::getY(void) const { return y; }
int Mitraillette::getMunition(void) const { return munition; }
int Mitraillette::getRecharge(void) const { return recharge; }
// Mutateur
void Mitraillette::setX(int valeur) { x = valeur; }
void Mitraillette::setY(int valeur) { y = valeur; }
void Mitraillette::setMunition(int valeur) { munition = valeur; }
void Mitraillette::setRecharge(int valeur) { recharge = valeur; }
//Fonction
void Mitraillette::init(sf::RenderWindow &window)
{
x = humanPosX;
y = humanPosY;
munition = 30;
recharge = 5;
etat = 0;
direction = 0;
}
void Mitraillette::update(sf::RenderWindow &window)
{
if (input.getButton().shoot)
{
direction = BulletL;
etat = AVANCE;
}
if (direction == BulletL && etat == AVANCE)
{
y += bulletsSpeed;
bullets.draw(window, map);
}
}
int humanPosX = human.getX();
int humanPosY = human.getY();
int bulletsSpeed = bullets.getSpeed();
Mitraillette::Mitraillette()
{
x, y;
munition;
recharge;
etat, direction;
}
// Accesseur
int Mitraillette::getX(void) const { return x; }
int Mitraillette::getY(void) const { return y; }
int Mitraillette::getMunition(void) const { return munition; }
int Mitraillette::getRecharge(void) const { return recharge; }
// Mutateur
void Mitraillette::setX(int valeur) { x = valeur; }
void Mitraillette::setY(int valeur) { y = valeur; }
void Mitraillette::setMunition(int valeur) { munition = valeur; }
void Mitraillette::setRecharge(int valeur) { recharge = valeur; }
//Fonction
void Mitraillette::init(sf::RenderWindow &window)
{
x = humanPosX;
y = humanPosY;
munition = 30;
recharge = 5;
etat = 0;
direction = 0;
}
void Mitraillette::update(sf::RenderWindow &window)
{
if (input.getButton().shoot)
{
direction = BulletL;
etat = AVANCE;
}
if (direction == BulletL && etat == AVANCE)
{
y += bulletsSpeed;
bullets.draw(window, map);
}
}
Merci pour vos explication