While trying to understand the pbPlots library i wrote a piece of code:
#include "pbPlots.hpp"
#include "supportLib.hpp"
#include <vector>
#include<iostream>
using namespace std;
void print(std::vector<double> const &input)
{
for (int i = 0; i < input.size(); i++) {
std::cout << input.at(i) << ' ';
}
}
int main(){
RGBABitmapImageReference *imageRef = CreateRGBABitmapImageReference();
vector<double> x = {1,2,3,4,5,6,7,8,9,10};
vector<double> y = {1,4,9,16,25,36,49,64,81,100};
/*for(int i = 1; i <= 10; i++){
x.push_back(i);
y.push_back(i*i);
}*/
//print(x);
//print(y);
/*int a;
cin >> a;*/
DrawScatterPlot(imageRef, 600, 400, &x,&y);
vector<double> *pngData = ConvertToPNG(imageRef->image);
WriteToFile(pngData, "plot.png");
DeleteImage(imageRef->image);
}
With the code above I wanted to create two vectors "x" and "y", and then plot them in a graph and export it to png.
At first I used the for loop to put values into the vectors automatically and then I built the programme with no errors given, but when i tried to run the a.exe I get the error below:
I then thought it could be related to the fact that i used a for loop so I inputed the values mannualy and built the programme again, and it built with no errors once again, but then when I tried to run a.exe again it gave exactly the same error it did before using the for loop.
Since I am new to pbPlots I wanted to know what I am doing wrong.
Im running Windows 10.