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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:41:47+00:00 2026-06-14T20:41:47+00:00

I tried compiling a simple program on Xcode and got the following messages: function<anonymous

  • 0

I tried compiling a simple program on Xcode and got the following messages:

function<anonymous namespace>::Initialize' has internal linkage but is not defined

function<anonymous namespace>::HandleBadInput' has internal linkage but is not defined

Undefined symbols for architecture x86_64:
  "(anonymous namespace)::Initialize()", referenced from:
      _main in main.o
  "(anonymous namespace)::HandleBadInput()", referenced from:
      _main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The header file looks like this:

#ifndef WJKErrorHandling
#define WJKErrorHandling

namespace WJKErrorHandling{

    void Initialize(void);
    int HandleBadInput(void);

}

#endif // defined(WJKErrorHandling)

the implementation file looks like this:

#include <iostream>
#include "WJKErrorHandling.h"

namespace WJKErrorHandling{

    void Initialize(void){

        std::cin.exceptions(std::cin.failbit);
    }

    int HandleBadInput(void){

        std::cerr << "Input Error: wrong type?\n";
        std::cin.clear();

        char BadInput[5];
        std::cin >> BadInput;

        return 1;
    }

}

and main.cpp looks like this:

#include <iostream>
#include "WJKErrorHandling.h"


void Prompt (void){

    //Prompts the user to begin entering numbers

    std::cout << "Begin entering numbers: \n";
}

float GetNumber (void){

    std::cout << "Number: \n";
    float Number;
    std::cin >> Number;
    return Number;
    }

std::string GetString (void){

    std::cout << "String: \n";
    std::string String;
    std::cin >> String;
    return String;

}

int main()
{
    Prompt();
    WJKErrorHandling::Initialize();

    int ReturnCode = 0;

    try{

        float Number = GetNumber();
        std::cout << Number;
        std::string String = GetString();
        std::cout << String;

        std::cout << "SUCCESS!!!!\n";

    }
    catch(...){

        ReturnCode = WJKErrorHandling::HandleBadInput();
    }


    return ReturnCode;
}

I’ve tried finding an answer so far, but I haven’t understood any of the posts that I’ve found. I’m new with C++, so any help would be greatly appreciated!

  • 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-14T20:41:48+00:00Added an answer on June 14, 2026 at 8:41 pm

    Your #define Guard is causing name lookup issue.

    change to below style should fix the issue:

    #ifndef WJK_ERROR_HANDLING_H
    #define WJK_ERROR_HANDLING_H
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Recently I tried compiling program something like this with GCC: int f(int i){ if(i<0){
I just tried to write a simple C program on OSX Lion #include <stdio.h>
I tried compiling and running this simple code but it's throwing error - (void)doSomething
Yesterday I installed clang 3.1 and g++ 4.7 and tried compiling a project I'm
I was trying to speed up some code, and then I tried compiling a
I' ve tried combining the module pattern with a constructor function but it seems
Tried following the instructions here: How to use Google app engine with my own
I am running a very simple C++ program: #include <list> #include <vector> int main(int
This is what I get when trying to compile a simple hello world program
So my program is working fine. Compiling, linking, running, the works. Then, I decide

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.