The wierdest header file ever?!
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??
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.
Post the contents of your header file if you may.
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.
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.
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
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.
You mean #include <string> right?
Anyways, this program compile just right before, and #include <string> isn't helping the errors!
Anyways, this program compile just right before, and #include <string> isn't helping the errors!
You need
#include <string>
using namespace std;
Or you need to replace "string" with "std::string".
#include <string>
using namespace std;
Or you need to replace "string" with "std::string".
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement