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 7027409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:14:36+00:00 2026-05-28T00:14:36+00:00

I keep getting a compilier error whenever I run this… I am quite sure

  • 0

I keep getting a compilier error whenever I run this… I am quite sure it is just something stupid that I am overlooking, so I though I would let you guys try.

#include <iostream>
#include <string>

using namespace std;

class hi
{
public:
    string run()
    {
        hi = "Hello.";
        return hi;
    }
private:
    string hi;
}

int main()
{
    bool end = false;
    string in = "";
    string out = "";

    hi hi;

    while(end != true)
    {
        cout << "Input a Command: ";
        cin >> in;
//        if(in == "help")
//        {
//            out = help.run;
//        }
        if(in == "hi")
        {
            out = hi.run;
        }

        cout << out;
        in = "";
    }
    return 0;
}

I keep getting these errors:

|6|error: new types may not be defined in a return type|
|6|note: (perhaps a semicolon is missing after the definition of 'hi')|
|18|error: two or more data types in declaration of 'main'|
||=== Build finished: 2 errors, 0 warnings ===|
  • 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-28T00:14:37+00:00Added an answer on May 28, 2026 at 12:14 am

    Near the end of your program you are closing more curly brackets than you have opened. You need to remove the curly bracket right before return 0;

    Also you need to terminate your definition of class hi with a semicolon after the closing curly bracket, right before the definition of main().

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

Sidebar

Related Questions

Keep getting this error after inserting a subdatasheet into a query and trying to
I keep getting tasks that are above my skill level. How can I address this without coming accross as grossly incompetent?
I keep getting this error ever so often when I launch the debugger to
I keep getting the error saying that the application.css isn't compiled. I tried: rake
I keep getting this error about my sql database NEW ERROR 07-03 01:52:08.037: ERROR/AndroidRuntime(627):
I've written a little header file, and I keep getting this error: expected specifier-qualifier-list
I'm trying to setup passenger with rvm. I keep getting this error Your RVM
I keep getting the error: Type was not found or was not a compile-time
With the following code, I keep getting error C2535 when I compile. It's complaining
I keep getting a PermGen error on my Tomcat 6 server. I know what

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.