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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:25:08+00:00 2026-06-13T12:25:08+00:00

Code: point3f.h Class Point3f { … inline void project2D(ProjType p, const Point2i& view) const;

  • 0

Code:

point3f.h

Class Point3f {
     ...
     inline void project2D(ProjType p, const Point2i& view) const;
};

point3f.cpp

inline void Point3f::project2D(ProjType p, const Point2i& view) const {
    switch(p) {
        case PROJ_XY:
            glVertex2f(x * view.x, y * view.y);
            break;
        case PROJ_YZ:
            glVertex2f(y * view.x, z * view.y);
            break;
        case PROJ_XZ:
            glVertex2f(x * view.x, z * view.y);
            break;
        default:
            break;
    }
}

Calling this function raises an error in compile time:

    undefined reference to `Point3f::project2D(ProjType, Point2i const&) const'

I tried every case without and with inline symbol:

inline in header, not in cpp:

 Warning: inline function ‘void Point3f::project2D(ProjType, const Point2i&) const’ used but never defined [enabled by default
 undefined reference to `Point3f::project2D(ProjType, Point2i const&) const'|

inline in header, also in cpp:

 Warning: inline function ‘void Point3f::project2D(ProjType, const Point2i&) const’ used but never defined [enabled by default
 undefined reference to `Point3f::project2D(ProjType, Point2i const&) const'|

inline not in header, but in cpp:

 undefined reference to `Point3f::project2D(ProjType, Point2i const&) const'|

inline not in header, neither in cpp:

 It works but that's not what I want

Question:

  1. Does const and inline member function make sense?
  2. How to declare a const and inline member function?

Thanks in advance.

  • 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-06-13T12:25:09+00:00Added an answer on June 13, 2026 at 12:25 pm

    The function being const has nothing to do with it. If you want it inline, you must define it in the header file instead of in point3f.cpp. Example:

    class Point3f {
        ...
        inline void project2D(ProjType p, const Point2i& view) const
        {
            switch(p) {
            case PROJ_XY:
                glVertex2f(x * view.x, y * view.y);
                break;
            case PROJ_YZ:
                glVertex2f(y * view.x, z * view.y);
                break;
            case PROJ_XZ:
                glVertex2f(x * view.x, z * view.y);
                break;
            default:
                break;
            }
        }
    };
    

    In this case, the inline keyword is not needed at all. If you define the function inside the class definition, inline is the default. But you can still specify it, if you want (as I’ve done in the above example.)

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

Sidebar

Related Questions

I have this code public void DetectFacesInImage(View view) { BitmapFactory.Options bitmapFactoryOptions=new BitmapFactory.Options(); bitmapFactoryOptions.inPreferredConfig= Bitmap.Config.RGB_565;
I have the code: class Point3D{ protected: float x; float y; float z; public:
I have the code: class Vector3D : public Vector{ protected: Point3D * start; Point3D
Code: NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; BOOL initial = YES; [invocation setArgument:&initial atIndex:2]; Question:
I have a code that get the coordinate of image view, and i want
In my view, I have: <UserControl x:Class ... MouseDown=UserControl_MouseDown> <Viewport3D Name=Viewport Grid.Column=0> ... </Viewport3D
I have the following code: public void DrawLetter(int Cell, string Letter, int X, int
OK, here is my code for what to paint on the progressbar: private void
In Java, I have a subclass Vertex of the Java3D class Point3f . Now
Code in my moving object: ObjectX.Location.Add(Velocity * Utils.GetMoveDir(start, destination)); Utility function: public static PointF

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.