Jump to content
  • Advertisement
Sign in to follow this  
orcfan32

The wierdest header file ever?!

This topic is 4812 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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??

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites
It would help a lot if you showed us those lines, as well as what comes before/after the point you #included it at.

Share this post


Link to post
Share on other sites
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_H
int CreateWND(string Title, int Width, int Height);
#endif

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Wow...

Share this post


Link to post
Share on other sites
You mean #include <string> right?

Anyways, this program compile just right before, and #include <string> isn't helping the errors!

Share this post


Link to post
Share on other sites
You need
#include <string>
using namespace std;

Or you need to replace "string" with "std::string".

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!