I am just starting to use Visual Studio C++. Before I was working with UNIX (years ago).
It looks like there are many things that I need to know. I copied a program from CPlusPlus.com and tried to compile it as a CLR console application. This is as far as I got:
// VectorStringCLR.cpp : main project file.
#include "stdafx.h"
#include<cstring>
#include<fstream>
#include<iostream>
#include<vector>
using namespace System;
int main() {
vector<string> list;
string word;
ifstream wordfile("TextFile1.txt");
while (wordfile >> word) {
list.push_back(word);
}
for (unsigned n=0; n<list.size(); ++n) {
cout << list.at( n ) << " ";
}
return 0;
}
When I tried to compile it here are the errors that I recieved:
1>------ Rebuild All started: Project: VectorStringCLR, Configuration: Debug Win32 ------
1>Deleting intermediate and output files for project 'VectorStringCLR', configuration 'Debug|Win32'
1>Compiling...
1>stdafx.cpp
1>Compiling...
1>AssemblyInfo.cpp
1>VectorStringCLR.cpp
1>.\VectorStringCLR.cpp(13) : error C2065: 'vector' : undeclared identifier
1>.\VectorStringCLR.cpp(13) : error C2065: 'string' : undeclared identifier
1>.\VectorStringCLR.cpp(13) : error C2065: 'list' : undeclared identifier
1>.\VectorStringCLR.cpp(15) : error C2065: 'string' : undeclared identifier
1>.\VectorStringCLR.cpp(15) : error C2146: syntax error : missing ';' before identifier 'word'
1>.\VectorStringCLR.cpp(15) : error C2065: 'word' : undeclared identifier
1>.\VectorStringCLR.cpp(16) : error C2065: 'ifstream' : undeclared identifier
1>.\VectorStringCLR.cpp(16) : error C2146: syntax error : missing ';' before identifier 'wordfile'
1>.\VectorStringCLR.cpp(16) : error C3861: 'wordfile': identifier not found
1>.\VectorStringCLR.cpp(17) : error C2065: 'wordfile' : undeclared identifier
1>.\VectorStringCLR.cpp(17) : error C2065: 'word' : undeclared identifier
1>.\VectorStringCLR.cpp(17) : fatal error C1903: unable to recover from previous error(s); stopping compilation
1>Generating Code...
1>Build log was saved at "file://c:\Users\Grace\Documents\Visual Studio 2008\Projects\VectorStringCLR\VectorStringCLR\Debug\BuildLog.htm"
1>VectorStringCLR - 12 error(s), 0 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
Okay. I am sure that I *REALLY* need some idea what I am doing. I am very ignorant
about Visual Studio, so please could someone GENTLY explain where I should begin
here. I am a bit embarrassed here. I am frustrated. Not giving up, but just trying
to find a simple way to read lines of data out of a file. In the next step I was
going to collect pointers to each element and the parse the lines for strings in them that would be separated by comas.
But as you see I gave up at this point. I suspect that there is something really wrong
with the way I am trying to use Visual Studio here.
Any Advice for this VS Newbie?