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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:10:18+00:00 2026-05-22T22:10:18+00:00

I have a class definition with a virtual method. On compiling I get the

  • 0

I have a class definition with a virtual method.

On compiling I get the error that 'MethodType Class::Method' is not a static member of class Class

The most popular solution I have found is to add the keyword static to the Method definition in the header file.

However, the method is defined as virtual. So to add the static keyword I will have to remove the virtual keyword. Unfortunately that cannot be done as the class inherits from a parent where this method is also declared virtual, leading to another compiler error. (Please note, I’m using defined interfaces and have no access to the parent class’s source code)

Does anyone have any ideas?


Header file:

class X : public OtherClass
{
   public:
      X();
      ~X();  

     virtual structType MethodName(ParamType1,ParamType2);

};

Then in the CPP file I have:

structType * X::MethodName(ParamType1 P1, ParamType2 P2)
{
   //Implementation here
}

And that gets flagged with error:

'structType* X::MethodName' is not a static member of 'class X'
  • 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-22T22:10:19+00:00Added an answer on May 22, 2026 at 10:10 pm

    Figured it out.

    Finally. In the implementation of MethodName1

         structType * X::MethodName(ParamType1 P1, ParamType2 P2)
    

    ParamType1 was a non-standard type. It is actually a class in the underlying application
    to which I have only the API.

    Turns out that the implemtation for class ParamType1 was missing / not compiled / something.

    The problem with linking was not to do with the class I loaded, even though it would appear as such because of the line the compiler provided.
    So for future reference, when using classes and struct in a function definition, keep an eye out for this linking error.

    Thanks for the assist again everyone.

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

Sidebar

Related Questions

I have a class with a static method that looks roughly like: class X
I have a the following method definition in my class: virtual Calc* Compile( Evaluator*
I have class method that returns a list of employees that I can iterate
I have class with internal property: internal virtual StateEnum EnrolmentState { get { ..getter
I have class with a member function that takes a default argument. struct Class
I know that calling a virtual method from a base class constructor can be
I have a C++/CLI class definition where I'm trying to get Equality testing to
I have a class like this public class Definition { public virtual string Name
Anyone knows if is possible to have partial class definition on C++ ? Something
Let's have the following class definition: CThread::CThread () { this->hThread = NULL; this->hThreadId =

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.