0

Edit:

This program compiles. It's only when run does it fail to find iostream. I'm using the libclang.dylib that is bundled with Xcode.

I've written a small tool to begin working with libclang. I'm trying to parse TranslationUnits. The following program is saved in the file tool.cpp. Once compiled and run, it tries to parse tool.cpp as a TU. It's failing to get a clean run with default headers as it cannot find iostream on my Mac. After several attempts to supply arguments that point to the file, it still doesn't work. Any ideas?

 #include "tool.h"
 #include <iostream>

 int main(int argc, char* argv[]) {
     CXIndex index = clang_createIndex(0,0);


     const char *args[] = {
     "-I/usr/include",
     "-I/usr/local/include",
     "-I.",
     "-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include",





     //Should be here
     "-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1"
     }

 ;

Output:

tool.cpp 6:10: 'iostream' file not found
bc888
  • 141
  • 14

1 Answers1

0

I've got the same issue. I am trying to add CPP to iOS Objective-C. It's not working. I found that this is about next "pain" from Apple because they do not use standard C++ library anymore. I've tried everything that mentioned on this site but haven't found any solution:

enter image description here enter image description here enter image description here