surreal5335
07-02-2010, 09:42 PM
I am working on a vector based program for my class.
Here is my simple setup I have right now:
#include <iostream>
#include <string>
#include <sstream>
#include <stdlib.h>
#include <vector>
using namespace std;
template <typename int>
void writeVector(const vector<int>& v);
void sortVector(vector<int>& v);
int main() {
vector<int> v; // int vector with 0 elements
~vector(); // destructor
system("PAUSE");
}
void writeVector(const vector<int>& v) {
template <typename int>
}
void sortVector(vector<int>& v) {
template <typename int>
}
Just trying to get the basic structure working first.
Here is the pile of errors I have so far:
C:\Documents and Settings\ben\Desktop\park\c++>g++ vector.cpp
vector.cpp:11: error: expected nested-name-specifier before "int"
vector.cpp:11: error: ISO C++ forbids declaration of `parameter' with no type
vector.cpp: In function `int main()':
vector.cpp:23: error: missing template arguments before '(' token
vector.cpp: In function `void writeVector(const std::vector<int, std::allocator<
int> >&)':
vector.cpp:54: error: expected primary-expression before "template"
vector.cpp:54: error: expected `;' before "template"
vector.cpp: In function `void sortVector(std::vector<int, std::allocator<int> >&
)':
vector.cpp:73: error: expected primary-expression before "template"
vector.cpp:73: error: expected `;' before "template"
I appreciate the help in any of these you can point out.
Here is my simple setup I have right now:
#include <iostream>
#include <string>
#include <sstream>
#include <stdlib.h>
#include <vector>
using namespace std;
template <typename int>
void writeVector(const vector<int>& v);
void sortVector(vector<int>& v);
int main() {
vector<int> v; // int vector with 0 elements
~vector(); // destructor
system("PAUSE");
}
void writeVector(const vector<int>& v) {
template <typename int>
}
void sortVector(vector<int>& v) {
template <typename int>
}
Just trying to get the basic structure working first.
Here is the pile of errors I have so far:
C:\Documents and Settings\ben\Desktop\park\c++>g++ vector.cpp
vector.cpp:11: error: expected nested-name-specifier before "int"
vector.cpp:11: error: ISO C++ forbids declaration of `parameter' with no type
vector.cpp: In function `int main()':
vector.cpp:23: error: missing template arguments before '(' token
vector.cpp: In function `void writeVector(const std::vector<int, std::allocator<
int> >&)':
vector.cpp:54: error: expected primary-expression before "template"
vector.cpp:54: error: expected `;' before "template"
vector.cpp: In function `void sortVector(std::vector<int, std::allocator<int> >&
)':
vector.cpp:73: error: expected primary-expression before "template"
vector.cpp:73: error: expected `;' before "template"
I appreciate the help in any of these you can point out.