The wierdest header file ever?!

Started by
14 comments, last by Lacutis 18 years, 9 months ago
Ok, I'm including my own header with ONLY FOUR LINES in it. My program has compiled before. (And this is with no changes) It's giving me the errors In file included from C:/CPP/Main.cpp:4: C:/CPP/Functions.h:6: error: `string' was not declared in this scope C:/CPP/Functions.h:6: error: syntax error before `,' token So, it says I have errors on line 6 with only 4 lines of code??
The best thing to do is just choose whatever you think you'd prefer, and go for it. -Promit
Advertisement
Maybe you have four lines of code but actually six lines, two are blank and just returns.

Post the contents of your header file if you may.
help us help you. No code, no help *sigh*
- To learn, we share... Give some to take some -
The incorrect line numbers are probably because something is being preincluded in your header, or something like that.

Anyway, to get past your error, it looks like you need to #include and say 'using namespace std::string' in the HEADER file. That should solve your compile problem.
It would help a lot if you showed us those lines, as well as what comes before/after the point you #included it at.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Actually, no, they aren't blank lines. They are backspaced out (is that a word?) anyways, here's the code:

#ifndef __FUNCTIONS_H#define __FUNCTIONS_Hint CreateWND(string Title, int Width, int Height);#endif
The best thing to do is just choose whatever you think you'd prefer, and go for it. -Promit
u forgot to include a required header. String is NOT a default datatype, and will require a header file to be included prior to usage.
- To learn, we share... Give some to take some -
Wow...
You mean #include <string> right?

Anyways, this program compile just right before, and #include <string> isn't helping the errors!
The best thing to do is just choose whatever you think you'd prefer, and go for it. -Promit
You need
#include <string>
using namespace std;

Or you need to replace "string" with "std::string".
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.

This topic is closed to new replies.

Advertisement