You are not logged in.

#1 2010-03-25 13:46:52

Isildur
Member
Registered: 2009-05-26
Posts: 100

c.vim Compiler Options

Hi

I'm new to C and therefore also new to c.vim. Apart from the a bit bloated comments it inserts by default(that can probably be changed in the templates) I stumbled across a problem. When compiling a GTK app I need compiler options like `pkg-config gtk+-2.0 --cflags --libs`. Where can I set these options in c.vim for usage with \rc? Is it maybe even possible to only use these flags when the gtk header is included?(would be a pretty fancy feature)

Thanks

Offline

#2 2010-03-25 14:12:29

Hohoho
Member
Registered: 2007-06-23
Posts: 222

Re: c.vim Compiler Options

Check the documentation, 4.1. Global variables:

g:C_CCompiler             "gcc"
g:C_CplusCompiler         "g++"
g:C_CFlags                 "-Wall -g -O0 -c"
g:C_LFlags                 "-Wall -g -O0"

These should be what you need.

Offline

#3 2010-03-25 15:16:53

Isildur
Member
Registered: 2009-05-26
Posts: 100

Re: c.vim Compiler Options

Sorry for the stupid question but can I change that from a config file or do I have to directly set it from vim(is it saved for the next time then)?

Offline

#4 2010-03-25 15:21:54

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,094

Re: c.vim Compiler Options

yes, no, no


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#5 2010-03-25 16:51:28

Isildur
Member
Registered: 2009-05-26
Posts: 100

Re: c.vim Compiler Options

Sorry again but how do I correctly change these values? I tried it via the .vimrc
set g:C_CFlags="pkg-config gtk+-2.0 --cflags --libs"

takes some time to get used to vim...

Offline

#6 2010-03-25 22:08:39

Hohoho
Member
Registered: 2007-06-23
Posts: 222

Re: c.vim Compiler Options

Use "let" instead of "set" for internal variables.

Offline

#7 2010-03-26 10:47:00

Isildur
Member
Registered: 2009-05-26
Posts: 100

Re: c.vim Compiler Options

Thanks no it works
let g:C_CFlags = "-Wall `pkg-config --cflags gtk+-2.0` -c"
let g:C_LFlags = "-Wall `pkg-config --libs gtk+-2.0` -o

Offline

Board footer

Powered by FluxBB