xoofx / CppAst.NET

CppAst is a .NET library providing a C/C++ parser for header files powered by Clang/libclang with access to the full AST, comments and macros
BSD 2-Clause "Simplified" License
501 stars 66 forks source link

can't work on macos? #23

Closed jiangzhhhh closed 4 years ago

jiangzhhhh commented 4 years ago

on macos, I simple try to use CppParser.Parse. It always can't find some standard c++ header(for example the stdio.h). whether specific parse options need to set?

wackoisgod commented 4 years ago

It does work on macOS, but depending on what you are parsing you may need to add some extra options for example these are the options I add on my little app:

p.TargetSystem = "darwin";
p.TargetVendor = "apple";
p.SystemIncludeFolders.Add("/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include");
p.SystemIncludeFolders.Add("/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1");
p.SystemIncludeFolders.Add("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include");
p.SystemIncludeFolders.Add("/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.0/include");
p.AdditionalArguments.Add("-stdlib=libc++");
jiangzhhhh commented 4 years ago

thanks, the parse options you provided can resolve my problem.