mercredi 4 mai 2016

No matching function to call to std::vector

I am writing a code for 3D world to 2D projection and as i try to push back coordinates in my vectors it gives me this error that there is no matching function to call to std::vector. I have searched over the internet for a while and i can't find a solution that works for me, can someone help? Please don't look at the draw line stuff there is supposed to be more code in between the lines I just want to fix this error first.

#include <X11/Xlib.h>
#include "draw.h"
#include "points.h"
#include "unistd.h"
#include <math.h>
#include <vector>



void draw(Display* d, Window w, GC gc)
{
    std::vector<float> xpoints;
    xpoints.push_back (-1.0, -1.0, 1.0, 1.0, -1.0, -1.0, 1.0, 1.0);

    std::vector<float> ypoints;
    ypoints.push_back(1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0);

    std::vector<float> zpoints;
    zpoints.push_back(-1.0, 1.0, 1.0, -1.0, -1.0, 1.0, 1.0, -1.0);

    for (;;)
    {

        XClearWindow(d, w);

        for (unsigned int c = 0; c < xpoints.size(); c++)
        {
            XDrawLine(d, w, gc, xpoints.at(c), ypoints.at(c+1), xpoints.at(c), ypoints.at(c+1));
        }
        XFlush(d);
        usleep(20000);
    }
}

thanks, Luka Jankovic

Aucun commentaire:

Enregistrer un commentaire