Bonjour à tous,
Je commence mon initiation au C++ avec le livre de Bjrane Stroustrup :
"Programmation, principes et pratique en c++"
Je travaille sur Dev C++ et je me heurte à un problème. Pour ceux qui connaissent, c'est au chapitre 12. Lorsqu'on aborde la programmation graphique.
J'ai téléchargé les fichiers ici :
http://www.stroustrup.com/Programming/Graphics/
Ensuite, j'ai rajouté le package fltk 1.1.9 via le gestionnaire de package de Dev C++.
Mon code est le suivant :
Mais, quand je veux compiler, je reçois ces erreurs :
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 #include "Graph.cpp" #include "Simple_window.cpp" int main(){ using namespace Graph_Lib; Point tl(100, 100); Simple_window win(tl, 600, 400, "Canvas"); win.wait_for_button(); return 0; }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 9 C:\Users\kajan\Documents\c++\graphics\Graph.cpp In file included from ../graphics/Graph.cpp 141 C:\Users\kajan\Documents\c++\graphics\Graph.h expected `,' or `...' before '&' token 141 C:\Users\kajan\Documents\c++\graphics\Graph.h ISO C++ forbids declaration of `Vector' with no type 142 C:\Users\kajan\Documents\c++\graphics\Graph.h expected `,' or `...' before '&' token 142 C:\Users\kajan\Documents\c++\graphics\Graph.h ISO C++ forbids declaration of `Vector' with no type C:\Users\kajan\Documents\c++\graphics\Graph.cpp In function `bool Graph_lib::line_segment_intersect(Point, Point, Point, Point, Point&)': 130 C:\Users\kajan\Documents\c++\graphics\Graph.cpp [Warning] converting to `int' from `double' 131 C:\Users\kajan\Documents\c++\graphics\Graph.cpp [Warning] converting to `int' from `double' 131 C:\Users\kajan\Documents\c++\graphics\Graph.cpp At global scope: 237 C:\Users\kajan\Documents\c++\graphics\Graph.cpp redefinition of `Graph_lib::Circle::Circle(Point, int)' 287 C:\Users\kajan\Documents\c++\graphics\Graph.h `Graph_lib::Circle::Circle(Point, int)' previously defined here 245 C:\Users\kajan\Documents\c++\graphics\Graph.cpp redefinition of `Point Graph_lib::Circle::center() const' 291 C:\Users\kajan\Documents\c++\graphics\Graph.h `Point Graph_lib::Circle::center() const' previously defined here C:\Users\kajan\Documents\c++\chapitre12\Makefile.win [Build Error] [../graphics/Graph.o] Error 1
J'ai beau me casser la tête, je vois pas d'où peux venir le problème. Surtout que là l'erreur est signalé sur les fichiers fournis, donc j'ai pas à les toucher normalement.
Merci d'avance.
Partager