I would like to start by using libclang with Python . I am trying to get a sample code ( http://www.altdevblogaday.com/2014/03/05/implementing-a-code-generator-with-libclang/ ) for working with Windows , here is the part of the code I'm trying to run:
#!/usr/bin/python
I have stripped off all the rest of the code, but I can post them if they are relevant. Line
index = clang.cindex.Index.create()
It produces the following error:
Setting clang path Clang path set Traceback (most recent call last): File "D:\libclangtest\boost_python_gen.py", line 60, in <module> index = clang.cindex.Index.create() File "D:\libclangtest\clang\cindex.py", line 2095, in create return Index(conf.lib.clang_createIndex(excludeDecls, 0)) File "D:\libclangtest\clang\cindex.py", line 141, in __get__ value = self.wrapped(instance) File "D:\libclangtest\clang\cindex.py", line 3392, in lib lib = self.get_cindex_library() File "D:\libclangtest\clang\cindex.py", line 3423, in get_cindex_library raise LibclangError(msg) clang.cindex.LibclangError: [Error 193] %1 is not a valid Win32 application. To provide a path to libclang use Config.set_library_path() or Config.set_library_file().
What is the reason for this? Am I setting the dll path incorrectly? I tried several ways, with forces and backslashes, I also tried to move the dll from the Program Files so that the path did not contain spaces, but nothing worked.
I start with libclang and Python if I ask something trivial.
python clang libclang
Mark vincze
source share