integrate a C and C++ program -
i trying control drone using image processing. image capture drone opencv c++ program. drone control program c program. want integrate both programs run single program can both images , control drone. how do that? c program socket program send commands drone , c++ program capture image stream drone tcp socket. there way or should convert 1 whole program language? help.
regards, shiksha
you have number of options. easiest may rename *.c
files *.cpp
- may compile directly in c++. may have issues linking external libraries built using c compiler. these linking issues can resolved guarding each header include with
extern "c" { #include "header_for_c_library.h" }
if isn't feasible (e.g. if c project consists of lot of files, or want keep compiling in c), may want build c part static library , link c++ program. go in other direction - build c++ component static library , link c program. downside have write c wrapper c++ code take effort (or impossible, depending on features of c++ use in api). care must taken ensure wrapper linked c symbols compatible c produces.
Comments
Post a Comment