Compile C 11 code on the Mac?

I am new to C 11. I tried:

clang -std = c 11 -stdlib = libc * .cc

It works, but my question is:

>Is there anyway to set these flags as default values ​​for clang?
>How to update g 4.2 to a version that supports C 11?
>Which way do you think is the best way to compile C 11 code on a Mac?

Thank you.

outside the IDE (for example, in the shell) , I usually set the variable CXX in .profile/.tcshrc/etc. to: “clang -std = c 11 -stdlib = libc”, because most configurations will select it. The script is also. On the cmd line, I might use : $CXX -c foo.cc

MacPorts gcc-4.8.1 works well: “[sudo] port install gcc48 [-universal]”

“[sudo ] port select –set gcc gcc48” will make it the default gcc, g, etc.

Don’t try to update or modify system tools, such as the old gcc-4.2/llvm hybrid that comes with Xcode.

I don’t know what you mean by the’best’ way in part 3 of the question, but with Apple’s support (they hired the lead author of LLVM), and behind other projects like FreeBSD, clang will only Continue to improve. It is already much faster than gcc, has better error messages/diagnostics (especially for C and templates), and a modular architecture. For OS X, it is the clear choice.

I am new to C 11. I tried:

clang -std = c 11 -stdlib = libc * .cc

It works, but my question is:

> Is there anyway to set these flags as default values ​​for clang?
>How to update g 4.2 to a version that supports C 11?
>Which way do you think is the best way to compile C 11 code on a Mac?

Thank you.

Outside the IDE (for example, in the shell), I usually in .profile/.tcshrc/etc Set the variable CXX to: “clang -std = c 11 -stdlib = libc”, because most configurations will select it as the script. On the cmd line I might use: $CXX -c foo.cc

< /p>

MacPorts gcc-4.8.1 works well: “[sudo] port install gcc48 [-universal]”

“[sudo] port select –set gcc gcc48” will make it The default gcc, g, etc.

Don’t try to update or modify the system tools, such as the old gcc-4.2/llvm hybrid that comes with Xcode.

I don’t know if you are on the 3rd of the question. What does the’best’ way in the section mean, but with the support of Apple (they hired the main author of LLVM), and behind other projects such as FreeBSD, clang will only continue to improve. It is already much faster than gcc, there are Better error messages/diagnostics (especially for C and templates), and modular architecture. For OS X, it is the clear choice.

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 1200 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.