I"ll preface this with the fact I'm pretty new to C++ (my background is in Java, so having to deal with these pointers is proving to be a little confusing). I'm trying to iterate through a vector that I passed to a function. I can't get this code to work for the life of me. Everything in my program compiles fine except for this one line of code. I keep getting this error:
mymetawindow.cpp: In constructor ‘MyMetaWindow::MyMetaWindow(const std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&)’:
mymetawindow.cpp:20: error: conversion from ‘__gnu_cxx::__normal_iterator<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >’ to non-scalar type ‘__gnu_cxx::__normal_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >’ requested
I have no idea what it means.
#include <QtGui>
#include <QTabWidget>
#include <QLabel>
#include <QString>
#include <iostream>
#include <string>
#include <vector>
#include "mymetawindow.h"
MyMetaWindow::MyMetaWindow(const std::vector<std::string>& tabNames )
{
fileMenu = menuBar()->addMenu(tr("&File"));
editMenu = menuBar()->addMenu(tr("&Edit"));
testLabel = new QLabel(QString(tr("This is a test")));
testLabel2 = new QLabel(QString(tr("This is a second test")));
myMetaTab = new QTabWidget();
setCentralWidget(myMetaTab);
std::vector<std::string>::iterator it = tabNames.begin(); //error in compiling is right here
}
Any help would be greatly appreciated.