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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T18:58:40+00:00 2026-06-18T18:58:40+00:00

When I run following code snippet from Xcode4.6 it compiles and runs fine. But

  • 0

When I run following code snippet from Xcode4.6 it compiles and runs fine. But when I try to compile it using command line tool (clang++) it fails to do so.

#include <iostream>
#include <memory>

int main(int argc, const char * argv[])
{

    std::unique_ptr<int> foo(new int(0));

    // insert code here...
    std::cout << "Hello, this is cool giri World!\n";
    return 0;
}

Here is compile log:

$ clang --version
Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.2.0
Thread model: posix

$ clang++ main.cpp -stdlib=libc++ -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/c++/4.2.1/ -I /usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/include/ 
main.cpp:7:10: error: no member named 'unique_ptr' in namespace 'std'
    std::unique_ptr foo(new int(0));
    ~~~~~^
main.cpp:7:24: error: expected '(' for function-style cast or type construction
    std::unique_ptr foo(new int(0));
                    ~~~^
main.cpp:7:26: error: use of undeclared identifier 'foo'
    std::unique_ptr foo(new int(0));
                         ^
3 errors generated.
  • 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-18T18:58:41+00:00Added an answer on June 18, 2026 at 6:58 pm

    You can look for yourself to see what command line Xcode used.

    1. Build your project in Xcode.
    2. Switch to log view. The icon for it looks like a speech bubble with a couple of lines in it.
    3. Click on the latest build.
    4. A list of build steps will show up in the main editing area. Right-click on “Compile main.cpp” and select “Copy Transcript for Shown Results”.
    5. Paste this into your favorite text editor to see the exact command line that Xcode used to build your project.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I run the following code from command line: public class MemoryTest { public static
I have following code snippet that i use to compile class at the run
I'm trying to run the following code, but I'm getting a Type mismatch compile
I'm using the following snippet of code to attempt to copy a file from
when I trying to run following code. var result = from c in db.brand
When I run the following Code it crashes at the last line. I don't
The following snippet is from a little app I wrote using the Qt framework.
I am using following code to scrape data from a website. # -*- coding:
I run the following code snippet. Public Shared Sub DisplayDnsConfiguration() Dim adapters As NetworkInterface()
i have run a code snippet from Gradle Cookbook apply plugin: 'java' task create-dirs

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.