Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Clang -fsyntax-only mode with static libraries?

Tags:

c++

clang

I am using libclang library to build autocomplete feature. libclang automatically -fsyntax-only flag internally. libclang seems to require entire source code tree available in order to work (or .pch files). What I want is to just pass single source file and a precompiled library (.a or .so) containing all the code it depends on?

I am unable to figure out how to do it.

like image 353
abhanshu Avatar asked Oct 17 '25 19:10

abhanshu


1 Answers

If you use -fsyntax-only you are asking clang to only examine the contents of the source file and the files which it includes. It doesn't even generate an object file, let alone require and libraries (static or shared).

You'll need at least the source file in question and all the header files that it includes (or a pre-compiled version of these). You will need at least the header files from the libraries that you include, you won't need a full source tree. How the headerfiles are usually packaged depends on the libraries that you are using. Frequently you get a "headers + libraries" distribution.

like image 199
CB Bailey Avatar answered Oct 20 '25 08:10

CB Bailey