Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clang(LLVM) compile with frameworks

I am using:

clang -ObjC -framework UIKit -o /var/compiled/c /Documents/Source/main.m

In OS X terminal. I also tried UIKit.framework, but I am getting

Fatal Error: 'UIKit/UIKit.h' not found

with both.

Any suggestions?

Thanks

like image 613
user1710004 Avatar asked May 05 '13 18:05

user1710004


People also ask

Does Clang use LLVM?

Clang uses the LLVM compiler as its back end and it has been included in the release of the LLVM since the LLVM 2.6. Clang is also built to be a drop-in replacement for GCC command. In its design, the Clang compiler has been constructed to work very similarly to GCC to ensure that portability is maximized.

Is LLVM better than GCC?

While LLVM and GCC both support a wide variety languages and libraries, they are licensed and developed differently. LLVM libraries are licensed more liberally and GCC has more restrictions for its reuse. When it comes to performance differences, GCC has been considered superior in the past.

Is LLVM same as Clang?

LLVM is a backend compiler meant to build compilers on top of it. It deals with optimizations and production of code adapted to the target architecture. CLang is a front end which parses C, C++ and Objective C code and translates it into a representation suitable for LLVM.

Is Clang better than GCC?

Clang is much faster and uses far less memory than GCC. Clang aims to provide extremely clear and concise diagnostics (error and warning messages), and includes support for expressive diagnostics. GCC's warnings are sometimes acceptable, but are often confusing and it does not support expressive diagnostics.


1 Answers

This has been already answered in the Apple developer forum, you can find the whole discussion in here. In the answer marked as the solution to the question they say:

1 - check your PATH variable first:

$ echo $PATH

2 - assuming /System/Library/Frameworks is not included in PATH, add it:

$ PATH=$PATH:/System/Library/Frameworks

3 -now we're ready for Mr. Kochun's incantation:

$ clang -fobjc-arc -framework Foundation main.m prog1
like image 179
tkanzakic Avatar answered Nov 03 '22 11:11

tkanzakic