Re: [Vala] How to make the CCode contains the local header ?

On Fri, Jan 01, 2010 at 18:25:59 +0800, G.S.Alex wrote:
When i write a vapi file to use some c code files , i use the
cheader_filename attribute to include the header file.
But the default generated code will use the system headers. For example :

        [CCode(cheader_filename = "case.h"]
will be
        #include <case.h>
        #include "case.h"

so , what should I do if i want to use the file in the current directory ?

Just tell the C compiler to look in the current directory for headers.

You need to have '-I.' in the C compiler options. If you are letting valac
drive the C compiler, than it would be '--Xcc=-I.'. If you are using
automake or similar, than it would be including '-I.' in the C flags

Note: There are actually cases, where using <> and including '.' in include
search path is prefered to using "". E.g. when you want to replace the
headers with mock version for unit testing or for build systems that use

                                                 Jan 'Bulb' Hudec <bulb ucw cz>

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]