OK I have written this small program that helps me learn Chinese and it works in C++ but I want to have a GUI for it current no GUI, So I am transferring it over to Visual C++ making changes as I need too. I have come to a problem with my Vectors.
Error
errorC2923:'std::vector' : 'words' is not a vaild template type argument for parameter '_Ty'
the error is happening here.
// Chinese learning.cpp : main project file.
#include "stdafx.h"
#include "Form1.h"
#include "words.h"
#include <vector>
#include <string>
#include <fstream>
using namespace Chineselearning;
//functions
void split(std::string, std::vector<std::string>&);
int checkword(std::vector<words>&, std::string);
void getword(std::vector<words>&, std::string);
void getfile(std::vector<words>&, std::vector<words>&);
//void outfile(std::vector<words>&, std::vector<words>&);
void print(std::vector<words>&);
int getrand(int);
void display(std::vector<words>&);
// TODO: Add extra initialization here
std::vector<words> vecWords;
std::vector<words> vecWordsTemp;
std::vector<std::string> words;
int input = 0;
int index = 0;
std::string lineIn;
//start
[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
// Enabling Windows XP visual effects before any controls are created
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
// Create the main window and run it
Application::Run(gcnew Form1());
getfile(vecWords, vecWordsTemp);
return 0;
}
//ERROR happening on this line std::vector<words>& vecTemp
int checkword(std::vector<words>& vecTemp, std::string word)
{
int index = -1;
if(vecTemp.size() != 0)
{
for(std::vector<int>::size_type ix = 0; ix != vecTemp.size(); ++ix)
{
if(vecTemp[ix].getNewWord() == word)
{
return ix;
}//end if
}//end forloop
}//end if
return index;
}//end checkword
words is a class not a template.
I am also getting some other error message that I have not looked at yet.
As I am learning Visual C++ please do not change the code and send it back to me. I would like to know what I am doing wrong and How to fix it.
Thanks.