Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 342509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T10:48:39+00:00 2026-05-12T10:48:39+00:00

I know this is quite a ridiculous question but this is quite confusing and

  • 0

I know this is quite a ridiculous question but this is quite confusing and irritating, as something that should work simply is not. I’m using Code Blocks with the GCC compiler and I am trying to simply create a string variable in my class

#ifndef ALIEN_LANGUAGE
#define ALIEN_LANGUAGE

#include <string>

class Language
{
    public:

    private:
        string str;
};

#endif

Strange enough, my compiler halts me with an error saying this:

C:\Documents and Settings\...|11|error: `string' does not name a type|
||=== Build finished: 1 errors, 0 warnings ===|

For some reason, it is unable to find the class “string” which for some reason, my main.cpp is able to detect “#include ” while my language class is not able for some reason.

This is the main I wrote quickly just to see it main itself is able to see the string file:

//main.cpp

#include <iostream>
#include <string>
#include "alien_language.h"

using namespace std;

int main()
{
    string str;

    return 0;
}

Does anyone know what’s going on?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T10:48:39+00:00Added an answer on May 12, 2026 at 10:48 am

    using namespace std;

    That’s what’s going on.

    You don’t have std:: prefixing the string in your class. Everything in the standard library is in the namespace std.

    It is generally regarded as bad practice to use using namespace std;, by the way. For more information on why and what to do instead, check out this question: Using std Namespace.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that this is quite a long and probably confusing post... but I
I know this question is quite basic but I am new to JQuery and
I know this question might sound quite silly, but I somehow found myself stuck
I know this question has been rised quite a lot of times, but then
I know this is quite a vague question -- sorry about that. If I
Hi I know this sounds quite not practical but still I would like to
I know this question has been asked before but the other solutions didn't work
I know this is quite possibly a lame question, but I've pulled three consecutive
I know this is quite a generic question but does anyone know a good
I know this question is quite basic but since there is lot of confusion

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.