GCC as main compiler on 10.9

Hello, I have been unable to succesfully install gcc 4.8 or 4.9 on Mac OS X Mavericks. Nor i can use clang anymore as well. I tried installing GCC with homebrew and followed some instructions to add plugin for XCode but it seems it broke both of the compilers. Mainly i want GCC because clang won't allow me to have definitions in separate cpp file. I get error that compiler can't 'read' symobls, but when i put definition in header file everything works fine.

OS X Mavericks (10.9.2)

Posted on Mar 4, 2014 8:57 AM

Reply
19 replies

Aug 26, 2014 4:07 AM in response to josephwb

josephwb wrote:


I work on developing code that is variously compiled on linux/mac. gcc compiling never has a problem. clang (only ever used on mac, it seems) is invariably a nightmare.

So?

So it sounds like your code is poor quality if it only compiles properly on lax systems like GCC and Linux. That is a common complaint form people who have never worked on other systems like OS X or Solaris. The refrain is always "...but it works on Linux". The cause is always incorrect code that Linux/GCC incorrectly accepts.

Sep 25, 2014 6:05 PM in response to mark133

OK, so I see the C libraries and includes are actually industry standards and can be found and reviewed almost anywhere on the web. On OS, while you could compile and use the standard includes on any system, the descriptive .h files are packaged with xCode. The difference between GCC and Clang is not a difference in the libraries, but a difference in the way that the compiler (and associated debugger) functions. LLVM is a compiler and debugger project (Clang and LLDB), not a C standard library project.


Probably the main difference between GNU and LLVM is the various kinds of dynamic functionality that have been made available for compiling and debugging (and therefore, for code). I guess this is how dynamic typing became available? And that kind of functionality cannot be standardized (since it depends on the compiler/debugging system).


Is it correct that learning to use Clang will give a command-line capability to compile C files with dynamic typing? What are some of the (other?) benefits of learning to use Clang properly vs. GCC?

Oct 4, 2014 6:21 PM in response to etresoft

There is a clear jumping-off point as a beginning developer with specific design requirements using clang. On the one hand, all I need to move into an objective C format is a header file? On the other hand, it looks like the clang people encourage learning to format configuration files.


I don't want to be a professional, I only want to get the job done. I also don't want to loose sight of the need for all of these fundamental tools to become common knowledge, sooner rather than later. My own children are already learning fundamental programming principles at 8 and 9 and I think a lot of this material should be included in standard highschool requirements within the decade (html and javascript, fundamental bash programming, C and objective C). But with the clang compiler, it seems that the major piece I'm missing as a beginner is the use of configuration files? But this is the same process for configuring apache, a router, various services, etc. So I guess the direction I'm seeing, or being directed to, is certainly that I should learn to use the configuration files properly and to get used to them. But I'm reluctant, wondering if this is crossing the line from a common programmer/computer user, to a more professional level of programming. On the other hand, shouldn't the knowledge of configuration files and how to use them be common knowledge before long (seeing how that reading and writing were once not common knowledge)? [The final piece of the same question is system security, a knowledge of which I am also having some difficulty sealing up well at the moment.]

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

GCC as main compiler on 10.9

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.