So I have a game in c++ console, and it's pretty big now. (over 3 megabytes)
I've been using strings in the code forever, but now, I need to make a separate exe program from scratch that will update the game when needed.

Big problem - this new program is not listening to almost any of my #include files that I give it. For example, I included:

And put in my code:

string latest_version;

yet c++ decided that I was crazy for saying that, and said:

21 C:\Jackpot\Developer\Jackpot 1.3 Beta (underway)\updater.cpp `String' does not name a type

I'm not sure what to do. Any ideas? I also tried to do ofstream and ifstream with the appropriate headers included, but same problem.

Thanks alot! :)

8 Years
Discussion Span
Last Post by Nick Evan

try this:

#include <iostream>
#include <string>

int main ()
    std::string test = "test 1-2-3";
    std::cout << test;

Note that C++ is case sensitive. string != String


^ Thanks!!
Your std:: solution reminded me that I forgot to use the:

using namespace std;

code at the top of my program.

So anyone in the future having this problem - thats how you fix it. Place:

using namespace std;

at the top of your code. :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.