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:
#include<string>

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! :)

Recommended Answers

All 3 Replies

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. :)

Or better: std::string

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.