Be compatible with a C++ compiler

Fix errors when compiling with a C++ compiler.
Merge pull request #22 from quark-zju/compatible-cpp

Be compatible with a C++ compiler