abhanshu
abhanshu

Reputation: 83

Using Clang -fsyntax-only mode with static libraries?

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.

Upvotes: 4

Views: 2737

Answers (1)

CB Bailey
CB Bailey

Reputation: 792079

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.

Upvotes: 5

Related Questions