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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T23:33:34+00:00 2026-05-28T23:33:34+00:00

I have most bizarre and probably simple to solve problem but it’s driving me

  • 0

I have most bizarre and probably simple to solve problem but it’s driving me crazy.

I’m using XCode 4, I’ve started with an empty project added a new file main.cpp containing:

#include <iostream>

using namespace std;

int main(int argc, const char * argv[]) {
    cout << "Hi There!" << endl;
}

Then I added a target called main and added main.cpp to it’s sources and compiled and run to be greeted with:

Hello, World!

In return.

Why is XCode adding and compiling it’s own main function and how to I tell it to use mine?

It also compiles and runs successfully with an empty main.cpp.

Thanks.

  • 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-28T23:33:34+00:00Added an answer on May 28, 2026 at 11:33 pm

    First try cleaning and rebuilding.

    If that doesn’t work sounds like there is another file with a main in it that is being included in the build.

    In the Project File, go into the “Build Phases” tab, and see what is listed under “Compile Sources”. The source of your problem might be there.

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

Sidebar

Related Questions

well i have most probably an extremly stupid problem but could not figure it
Quick one. I'm using mod rewrite and have most replacements in place: empty space
I am using xCode 4.2. I have most of the interface in the mainstoryboard.xib.
I have the most bizarre bug, where clicking a listbox item makes the listbox
I have spent most of my web-development career in the Microsoft camp, but for
I have the most basic jquery function of them all, but I couldn't find
I am using ASP.NET 2.0 and its various providers. I have overridden most of
Of course most languages have library functions for this, but suppose I want to
I have for the most part successfully embedded firefox/xulrunner into our c# application, but
In H&S5 I encountered the most bizarre switch statement (8.7.1, p. 277) not using

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.