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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:13:38+00:00 2026-05-23T09:13:38+00:00

This is really trivial but I’m getting an error I didn’t expect. I have

  • 0

This is really trivial but I’m getting an error I didn’t expect.

I have some code which is inside of a namespace

the following is some pseudocode that represents the structure of my code:

namespace A {
    void init() {
        initialize_kitchen_sink();
    }
    #include "operations.h" // declares shake_and_bake()
    void foo() {            
        shake_and_bake();
    }
    void cleanup() {
        // do nothin' cuz i'm a slob
    }
}

error:

undefined reference to `A::shake_and_bake`
  • 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-23T09:13:38+00:00Added an answer on May 23, 2026 at 9:13 am

    Turns out moving the #include outside the namespace will fix it.

    As it was, the include would be in effect declaring all of the functions in operations.h inside the A namespace. Then it would search in vain for the implementations.

    I figure instead of deleting my entire post i may as well leave it for that minute possibility that someone else may stumble upon a similar problem and be enlightened.

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

Sidebar

Related Questions

This is really strange but this code is working fine unless the value entered
This might be a really trivial question, but I've been writing Java programs at
I'm really embarrassed to ask such a trivial question but debugging some software now
I've been working on this small piece of code that seems trivial but still,
I'm probably making a really simple error somewhere, but for some reason the event
This really has my stumped today. I'm sure its simple, but... Here is my
This sounds really stupid, but I was told that you could drag-and-drop visual components
This is really stumping me today. I'm sure its not that hard, but I
I´m not sure if this is really a programming question, but it's related to
This really should be easy, but I just can't work it out myself, the

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.