Is it possible to compile a c/c++ mixed source code? -


we have c project, , want combine c++ project c project, , compile them 1 binary, possible?

something like

cproject/src/ cproject/src/a.h cproject/src/a.c cproject/src/b.h cproject/src/b.c cproject/src/main.c 

add cppproject

cproject/cppproject/src/c.h cproject/cppproject/src/c.cpp cproject/cppproject/src/m.h cproject/cppproject/src/m.cpp 

maybe compile cpp shard library , link it?

yes can. have project in c , in c++. way resolve (" shard library , link it?") thing.

as other people noted can:

1) mix c , c++ (using extern "c" )

2) make project subproject (in xcode mac standard practice add project existing project

3) sure there 1 main()

4) you want external lib, no need mix them, exposing methods, managing includes andlinkage options , passing parameters can bit complex if not experienced.

libs , dll different normal "main()" program.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -