Bonjour,
Je suis sous netbeans et je développe avec la SFML.
J'ai récemment résolu un problème d'inclusion de fichier au projet mais désormais un autre soucis arrive.
Quand j'essaye d'assigner une image à un sprite j'ai une erreur, ou plein en fait.
Mon main contient ça (c'est encore en phase de test).
Mon code erreur est :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59 #include <SFML/Graphics.hpp> #include <SFML/System.hpp> #include <SFML/Audio.hpp> #include <SFML/Network.hpp> #include <SFML/Window.hpp> #include <iostream> #include "Bloc.cpp" using namespace std; using namespace sf; int main() { std::string buffer; bool runApplication = true; sf::RenderWindow App(sf::VideoMode(800,640,32),"Fenetre 1"); App.SetPosition(0,0); App.Clear(); App.Display(); View Vue1; App.SetView(Vue1); // Bloc b0; // b0.MoveBloc(0,0); // b0.image.LoadFromFile("test_image.jpg"); sf::Image Image; Image.LoadFromFile("test_image.jpg"); sf::Sprite Sprite; Sprite.SetImage(Image); App.Display(); while(runApplication) { sf::Event Event; while(App.GetEvent(Event)) { if (Event.Type == sf::Event::Closed){ App.Close(); runApplication = false; } if(Event.Type = sf::Event::KeyPressed) { // cout << Event.Key.Code << endl; } } } return EXIT_SUCCESS; }
outre l'erreur que je ne comprend pas, je me demande si c'est bien normal de devoir inclure le fichier .cpp pour mes classes?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 c:/Users/Eternal/Desktop/Dev/C++/SFML-1.6/lib/libsfml-graphics-s-d.a(Sprite.o): In function `Sprite': D:/dev/sfml/sdk/SFML-1.6/src/SFML/Graphics/Sprite.cpp:38: multiple definition of `sf::Sprite::Sprite()' c:/Users/Eternal/Desktop/Dev/C++/SFML-1.6/lib/libsfml-graphics-d.a(d000129.o):(.text+0x0): first defined here c:/Users/Eternal/Desktop/Dev/C++/SFML-1.6/lib/libsfml-graphics-s-d.a(Sprite.o):D:/dev/sfml/sdk/SFML-1.6/src/SFML/Graphics/Sprite.cpp:64: multiple definition of `sf::Sprite::SetImage(sf::Image const&)' c:/Users/Eternal/Desktop/Dev/C++/SFML-1.6/lib/libsfml-graphics-d.a(d000127.o):(.text+0x0): first defined here c:/Users/Eternal/Desktop/Dev/C++/SFML-1.6/lib/libsfml-graphics-s-d.a(Drawable.o): In function `~Drawable': D:/dev/sfml/sdk/SFML-1.6/src/SFML/Graphics/Drawable.cpp:56: multiple definition of `sf::Drawable::~Drawable()' c:/Users/Eternal/Desktop/Dev/C++/SFML-1.6/lib/libsfml-graphics-d.a(d000168.o):(.text+0x0): first defined here c:/Users/Eternal/Desktop/Dev/C++/SFML-1.6/lib/libsfml-graphics-s-d.a(Image.o): In function `Image': D:/dev/sfml/sdk/SFML-1.6/src/SFML/Graphics/Image.cpp:43: multiple definition of `sf::Image::Image()' c:/Users/Eternal/Desktop/Dev/C++/SFML-1.6/lib/libsfml-graphics-d.a(d000077.o):(.text+0x0): first defined here c:/Users/Eternal/Desktop/Dev/C++/SFML-1.6/lib/libsfml-graphics-s-d.a(Image.o): In function `~Image': D:/dev/sfml/sdk/SFML-1.6/src/SFML/Graphics/Image.cpp:113: multiple definition of `sf::Image::~Image()' c:/Users/Eternal/Desktop/Dev/C++/SFML-1.6/lib/libsfml-graphics-d.a(d000082.o):(.text+0x0): first defined here c:/Users/Eternal/Desktop/Dev/C++/SFML-1.6/lib/libsfml-graphics-s-d.a(Image.o):D:/dev/sfml/sdk/SFML-1.6/src/SFML/Graphics/Image.cpp:124: multiple definition of `sf::Image::LoadFromFile(std::string const&)' c:/Users/Eternal/Desktop/Dev/C++/SFML-1.6/lib/libsfml-graphics-d.a(d000062.o):(.text+0x0): first defined here c:/Users/Eternal/Desktop/Dev/C++/SFML-1.6/lib/libsfml-graphics-s-d.a(Color.o): In function `Color': D:/dev/sfml/sdk/SFML-1.6/src/SFML/Graphics/Color.cpp:63: multiple definition of `sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)' c:/Users/Eternal/Desktop/Dev/C++/SFML-1.6/lib/libsfml-graphics-d.a(d000054.o):(.text+0x0): first defined heremake[2]: Leaving directory `/c/Users/Eternal/Documents/NetBeansProjects/CppApplication_3' make[1]: Leaving directory `/c/Users/Eternal/Documents/NetBeansProjects/CppApplication_3' collect2: ld returned 1 exit status make[2]: *** [dist/Debug/MinGW_V1-Windows/cppapplication_3.exe] Error 1 make[1]: *** [.build-conf] Error 2 make: *** [.build-impl] Error 2
Merci d'avance.
Partager