Microsoft's 2010, vector, multi-file.

hey... i wrote a program in visual studio 2010, when using vector in multi-file program a problem occurs.
i made the program in one piece though and it worked like magic.
when i splitted it into multiple files it didn't recognize the declaration of a function. here are main files:

headers.h
1
2
3
4
5
6
7
8
9
10
#pragma once

#include <iostream>
#include <fstream>
#include <cstdlib>
#include <vector>
#include "Support_Methods.h"

using namespace std;


Support_Methods.h
1
2
3
4
#pragma once
#include "headers.h"

void show_vector(vector<int> v);


Support_Methods.cpp
1
2
3
4
5
6
7
8
9
10
11
12
#pragma once
#include"headers.h"
void show_vector(vector<int> v)
{
	cout.width(4);
	vector<int>::iterator iter;
	for( unsigned int i =0 ; i < v.size() -1; i++)
	{
		cout.width(4);
		cout<<v[i];
	}
}

when i compile i get an error, it points to show_vector() in the (.h) and says "vector: undeclared identifier."

i've been solving silly questions for about 2 hours now, i hope my silly question gets answered ^_^ -if you don't know, this was a joke-.
Last edited on
I was about to say the rather-obvious answer, but then I read the last sentence... Well, sadly such answers aren't always as plainly obvious to those doing the assignments (which most help on this subforum usually are) as they are to us who regularly help out.
which last sentence you mean???
i didn't really get what you said, i'm afraid you're unhappy because of some, is that correct?
and if so, did i say something wrong?
i really didn't mean any offence to any one in the last sentence.
1
2
3
4
//headers.h
#include "Support_Methods.h"
//Support_Methods.h
#include "headers.h" 
If you got circular dependance, chances that something will be horribly broken is quite high.
I have some idea: try to specify void show_vector(std::vector<int> v);

Last edited on
Well, the last sentence made me think that the post was a joke (hence it being "if you don't know, this was a joke-."). I guess I misread it.
no, the post is not a joke, i just wanted to give the reader something funny as a try to be friendly, that's all, but i thought my friendliness could be misunderstood in the wrong way, i just didn't understand your comment mr.Ispil, i was afraid you got me wrong ^_^.


and for you mr.MiiNiPaa, i would like to thank you very much for your help, my program now works.
Last edited on
Topic archived. No new replies allowed.