-1

I want to use clang convert Object - C to C + +, quoted error is as follows:

userdeMac-mini:Demo xxx$ clang -rewrite-objc main.m

main.m:9:9: fatal error: 'UIKit/UIKit.h' file not found

import <#UIKit/UIKit.h>

1 error generated.

Excuse me, how should solve ?

Community
  • 1
  • 1
f22x
  • 1
  • 3

3 Answers3

2

This works for me. You can try by changing the path according to your SDK location.

clang -x objective-c -rewrite-objc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.1.sdk ViewController.m
Jeff.Lu
  • 574
  • 3
  • 16
1
main.m:9:9: fatal error: 'UIKit/UIKit.h' file not found

That means that the UIKit headers can't be found. Do you have the iOS SDK installed somewhere? Have you configured the search paths in your makefile (or build environment) correctly?

The easiest way to start investigation is to start with a working Xcode project, compile a single .m file, and then see the command line that was used to compile that file. The clang rewriter takes slightly different options, but the search paths and a lot of the other configuration are the same.

bbum
  • 162,346
  • 23
  • 271
  • 359
  • I tried this method at [link](http://stackoverflow.com/questions/16387484/clangllvm-compile-with-frameworks? Rq = 1), but it doesn't work – f22x Sep 07 '15 at 03:04
0

First of all, you should use the "cd" command to enter to "clang - rewrite - objc" file directory, then use a command such as "clang - x objective - c - rewrite - objc - isysroot/Applications/Xcode. The app/Contents/Developer/Platforms/iPhoneSimulator platform/Developer/SDKs/iPhoneSimulatorX X.s dk X.m", the "X" is the version of your iPhoneSimulator and "clang - rewrite - objc" file name.

JackySong
  • 154
  • 1
  • 4