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
Post a Comment