Graphics include libraries

Include directories not working, trying to make a triangle.


#include <iostream>
#include <Simple_window.h>
#include <Graph.h>

int main()
{
using namespace Graph_lib;

Point tl{100,100};

Simple_window win {tl,600,400,"Canvas"};

Polygon poly;

poly.add(Point{300,200});
poly.add(Point{350,100});
poly.add(Point{400,200});

poly.set_color(Color::red);

win.attach (poly);

win.wait_for_button();
}

You're most likely having link errors. Ensure you linked the files correctly (through your project's properties). Alternatively, you can try copying over the files into your .sln and include them the same way you would include any other programmer-defined header files.
Where are the Simple_window.h and Graph.h files located? If they are in the same directory as your own code file you probably have to use double quotes when including them.

1
2
#include "Simple_window.h"
#include "Graph.h" 
Last edited on
Hello

Have you tried it only with one point? Does it work with the simple task (one point, one place)? Just to check whether the issue is with including directories or the syntax error. If it works fine, then the problem is in coding.

David

This company https://hireessaywriter.org/ C++ tutorials.
Last edited on
Topic archived. No new replies allowed.