Probleme mit Polygon in Stroustrups PPP-Buch
Ich lese Programmierprinzipien und -praxis mit C ++, Stroustrups Buch. In Kapitel 12 und auf Seite 441 gibt es diesen Code:
//
// This is example code from Chapter 12.3 "A first example" of
// "Programming -- Principles and Practice Using C++" by Bjarne Stroustrup
//
#include "Simple_window.h" // get access to our window library
#include "Graph.h" // get access to our graphics library facilities
//------------------------------------------------------------------------------
int main()
{
using namespace Graph_lib; // our graphics facilities are in Graph_lib
Point tl(100,100); // to become top left corner of window
Simple_window win(tl,600,400,"Canvas"); // make a simple window
Polygon poly; // make a shape (a polygon)
poly.add(Point(300,200)); // add a point
poly.add(Point(350,100)); // add another point
poly.add(Point(400,200)); // add a third point
poly.set_color(Color::red); // adjust properties of poly
win.attach (poly); // connect poly to the window
win.wait_for_button(); // give control to the display engine
}
//------------------------------------------------------------------------------
Wenn ich den Code laufen lasse, erhalte ich 13 Störungen, die von ihnen ungefähr sein müssenPolygon Kennung. Zum Beispiel ist der erste Fehler:Fehler C2872: 'Polygon': Mehrdeutiges Symbol
Warum mein Compiler das nicht weißPolygon Bitte?