Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Testing C code with googletest (Google C++ Testing Framework)

I'm trying to test C code with googletest but I'm having some problems when my C header files are included in the C++ test file because the g++ compiler handle them as C++ headers.

I've tried to include these headers inside extern "C" {} with no success.

Is there a way g++ compiler can handle these headers as C ones?

like image 419
carlosalbertomst Avatar asked Oct 22 '25 02:10

carlosalbertomst


1 Answers

extern "C" only changes link stage name mangling. If you are using C features that aren't shared by C++ then you are SOL

like image 66
totowtwo Avatar answered Oct 24 '25 17:10

totowtwo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!