Following this solution, I use #include "...frontend/tokens.mll"
in my lexer.mll
, then I use cpp -P frontend/lexer.mll -o frontend/gen/lexer.mll
to generate the complete mll file. This solution worked before under Ubuntu.
Now, I try to do this in Mac OS 10.11.1
, it gives an error clang: error: no input files
.
gcc -v
returns
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 7.3.0 (clang-703.0.29) Target: x86_64-apple-darwin15.0.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin
I don't see where I use XCode, or PCH file. Does anyone know how I should configure the environment to make cpp
work?
Edit 1:
cpp --version
returns
Apple LLVM version 7.3.0 (clang-703.0.29) Target: x86_64-apple-darwin15.0.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin
And an example from the comment:
4 Answers
Answers 1
It could be a bug from clang, as this one works for me:
$ cpp -P xxx yyy $ cat yyy from zzz
and
$ clang --version Apple LLVM version 7.0.2 (clang-700.1.81) Target: x86_64-apple-darwin14.5.0 Thread model: posix
Answers 2
So if I understand correctly what you are trying to do, you want to run the c preprocessor on a file to produce text output which will be stored in another file. I don't know why but, here is a command that will accomplish that :
clang -x c frontend/lexer.mll -E -P -o frontend/gen/lexer.mll
This invokes clang; sets the language it C (-x c
); gives your file; asks for preprocessing only, no compile or link (-E
); no line info in the output (-P
), stores it in frontend/gen/lexer.mll
Xcode is an IDE that runs clang. If you are working in ocaml it may not be helpful ti use Xcode since it wouldn't know what to do with ocaml files.
Answers 3
1 - open XCode
2 - Create a new XCode project
3 - choose tab of OSX
4 - choose Application
5 - choose Command Line tool
6 - in next window you have to enter product name etc
7 - and choose c++ as a language
Answers 4
'cpp -P xxx -o yyy' you need it to be -> 'echo "blahblahblah.cpp" > xxx'
0 comments:
Post a Comment