Take the 2-minute tour ×

I have setup a simple project to test viability of VIM as C++ complier plus a simple makefile from a tutorial, but I can't seem to generate .clang_complete file from cc_args.py script.

Readme says I should run:

make CC='~/.vim/bin/cc_args.py gcc' CXX='~/.vim/bin/cc_args.py g++' -B

But it won't generate .clang_complete file from makefile.

Here is my simple project.

#include "hello.h"

int main(void)
    return 0;

#include <iostream>
#include "hello.h"

void hello()
    std::cout << "Hello world!";

#ifndef HELLO_H
#define HELLO_H
void hello();


DEPS = hello.h
OBJ = hello.cpp hello_fn.cpp

%.o: %.cpp $(DEPS)

hello: $(OBJ)
    g++ -o $@ $^ $(CFLAGS)

hello.h is in directory called head.


make CC='.vim/bundle/clang_complete/bin/cc_args.py gcc' CXX='.vim/bundle/clang_complete/bin/cc_args.py g++' -B



yields no .clang_complete file.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Your Makefile ignores the CC and CXX environmental variables and just uses g++ directly. Change the hello rule to

hello: $(OBJ)
    $(CXX) -o $@ $^ $(CFLAGS)

And then make CXX='.vim/bundle/clang_complete/bin/cc_args.py g++' -B should work.

The %.o: %.cpp $(DEPS) rule does use CC, but this rule is never used since your OBJS variable are all .cpp and not .o variables.

share|improve this answer
Thank you very much! –  RedSparrow Nov 21 '12 at 10:14
Will not work if one uses cmake since makefile generated by it does not respect both CC and CXX. –  Haroogan Dec 8 '12 at 22:22
@Haroogan cmake respects CC and CXX environmental variables. You just have to delete the CMakeCache.txt file so it gets recreated. –  David Brown Dec 10 '12 at 5:28
Of course I did it, you can actually inspect makefile contents and see that gcc and g++ invocations are hard-coded there. –  Haroogan Dec 10 '12 at 18:25
add comment

Your Answer


