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

  • SEARCH
  • Home
  • 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 7577467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:11:33+00:00 2026-05-30T17:11:33+00:00

I’m having a weird error (missing ‘;’, string class not recognized, etc) on an

  • 0

I’m having a weird error (missing ‘;’, string class not recognized, etc) on an C++ abstract class (which other classes need to inherit and instanciate). Also I want derived classes to be forced to implement the abstract class methods – hence the pure virtual = 0.

Below is my abstract class definition.

Drawable.h:

#ifndef __myns__managers__Drawable_h__
#define __myns__managers__Drawable_h__

#include <string>

namespace myns
{
    namespace managers
    {
        class Drawable;
    }
}

namespace myns
{
    namespace managers
    {
        class Drawable
        {
            public:
                virtual float getX() = 0;
                virtual float getY() = 0;
                virtual string getImageFilePath() = 0;
            protected:
                int drawableId;

        };
    }
}

#endif

By my relative knowledge of C++ I guess that’s everything ok, right? But when I compile on VS 2010 it gives me a bunch of compile errors – shown below.

How can I solve this? Thanks in advance.

VS Build Output:

1>------ Build started: Project: InteractiveMembranes_vc10, Configuration: X86 Debug Win32 ------
1>  OutputManager.cpp
1>(project dir)\managers\drawable.h(23): error C2146: syntax error : missing ';' before identifier 'getImageFilePath'
1>(project dir)\managers\drawable.h(23): error C2433: 'interactivemembranes::managers::Drawable::string' : 'virtual' not permitted on data declarations
1>(project dir)\managers\drawable.h(23): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>(project dir)\managers\drawable.h(23): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>(project dir)\managers\drawable.h(23): warning C4183: 'getImageFilePath': missing return type; assumed to be a member function returning 'int'
1>(project dir)\managers\drawable.h(23): error C2253: 'interactivemembranes::managers::Drawable::getImageFilePath' : pure specifier or abstract override specifier only allowed on virtual function
1>  Application.cpp
1>(project dir)\managers\drawable.h(23): error C2146: syntax error : missing ';' before identifier 'getImageFilePath'
1>(project dir)\managers\drawable.h(23): error C2433: 'interactivemembranes::managers::Drawable::string' : 'virtual' not permitted on data declarations
1>(project dir)\managers\drawable.h(23): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>(project dir)\managers\drawable.h(23): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>(project dir)\managers\drawable.h(23): warning C4183: 'getImageFilePath': missing return type; assumed to be a member function returning 'int'
1>(project dir)\managers\drawable.h(23): error C2253: 'interactivemembranes::managers::Drawable::getImageFilePath' : pure specifier or abstract override specifier only allowed on virtual function
1>  Generating Code...
1>  Compiling...
1>  TestPersistence.cpp
1>  Generating Code...
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
  • 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-30T17:11:34+00:00Added an answer on May 30, 2026 at 5:11 pm

    You need to qualify string:

    virtual std::string getImageFilePath() = 0;
    

    string is in the std namespace, not in the global one. There’s also the option of using namespace std; which will import the namespace into the global one, but don’t do it, especially in headers. I’m just presenting it as an option, but you should always prefer qualifying the names.

    EDIT: As Als pointed out, you can import only what you need: using std::string;. I’d still prefer qualifying the name though.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I've got a string that has curly quotes in it. I'd like to replace
Specifically, suppose I start with the string string =hello \'i am \' me And

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.