When i compile this code i get an error which states

main.cpp|38|error: no match for call to ‘(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> > > >) (long int&)’|

I am going to assume that this is something to do with trying to put the string in a different kind of string, so how should I fix this error, thanks in advance.

#include <iostream>
#include <fstream>
#include <vector>
using namespace std;

int main()
{

string LogicMolecule;
string ExecutableCodeName;
string LogicMoleculeFileName;
vector<string> LogicMolecules;
long index;

cout << "Execute: ";
cin >> ExecutableCodeName;

ExecutableCodeName = ExecutableCodeName + ".code";

ifstream ExecutableCodeFile;
ExecutableCodeFile.open(ExecutableCodeName.c_str());

if (!ExecutableCodeFile.is_open())
{
cout << "\n";
cout << "error: can't open ";
cout << ExecutableCodeName;
}

while (ExecutableCodeFile >> LogicMolecule)
{
	LogicMolecules.push_back(LogicMolecule);
}

ExecutableCodeFile.close();

index = 0;
LogicMoleculeFileName = LogicMolecules(index) + ".logic molecule";
ifstream LogicMoleculeFile;
LogicMoleculeFile.open(LogicMoleculeFileName.c_str());


if (!LogicMoleculeFile.is_open())
{
cout << "\n";
cout << "error: can't open ";
cout << LogicMoleculeFileName;
}
}

ok that worked, wow thanks i feel like a complete noob, its my dumb VB6 class practices catching up with me lol.

This question has already been answered. Start a new discussion instead.