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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:15:52+00:00 2026-05-25T06:15:52+00:00

I wrote a c++ program using boost library in Xcode. Here is my code.

  • 0

I wrote a c++ program using boost library in Xcode. Here is my code. It is very simple.

#include <iostream>
#include </usr/local/include/boost/math/special_functions/beta.hpp>

using namespace std;
using namespace boost::math;

int main (int argc, char * const argv[]) 
{
    double a = 100.0;
    double b = 100000.0;
    double x = 0.3;
    double result = beta(a, b, x);

    cout << result << endl;
    return 0;
}

But when I tried to build it in the Xcode, there popped up a lot of errors related to the library linking stuff. I noticed that the compiler that Xcode was using was “System Default: gcc 4.2”. And all other options are gcc or LLVM gcc (I have no idea what this is).

I later tried to compile the file simply using terminal. Weird thing happened. If I compile it with g++, without any extra flags, the compilation completed successfully and the the program could be ran normally; but if I compile it with gcc, there are pages of errors.

So, to sum it up, while using g++, everything is OK; while using gcc, everything is not OK. Since the Xcode is using gcc, the program could not be compiled using Xcode.
(And I kind of need to use the Xcode because this is just a test program, I actually have a much bigger project to handle and I depend on the debugger of Xcode.)

So my question is, WHAT THE HELL is the difference between gcc and g++? Or how can I change the compiler of Xcode to g++?

  • 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-25T06:15:52+00:00Added an answer on May 25, 2026 at 6:15 am

    The gcc command compiles C files (although you can use -libstdc++) to link C++ files as well but I don’t recommend it.
    The g++ command works for C++ files which is why it worked in your case.

    For XCode you have to change the compiler from GCC to G++ for it to successfully work.

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

Sidebar

Related Questions

I wrote a program in c++ in VC++2008 with boost library for regular expression.
I wrote a program using AutoIT to fetch information from a number of websites
I wrote a simple Windows Forms program in C#. I want to be able
I wrote the following program for alternatively incrementing and doubling a counter(increment first) using
I wrote the same program two ways. One using a Surfaceview, and the other
I wrote this simple program today, but I found that cin.get() refuses to work
I wrote a program using sqlite but when I run it there seems no
I have written a simple network program on java using sockets. Program has a
I have written a simple network program on java using sockets. Program has a
I wrote a program in c++ leveraging header files from boost. When I compiled

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.