EEVblog Electronics Community Forum

Products => Computers => Programming => Topic started by: Simon on November 01, 2021, 01:58:05 pm

Title: [C/C++] Mixing C and C++
Post by: Simon on November 01, 2021, 01:58:05 pm
So, how do I do it? My use case is that I know C but have C++ files to incorporate. What should I do?

I have found the stuff about marking a C header file at C in a C++ environment. If I write C is that automatically interpreted correctly as C is a subset of C++?

I am using Microchip Studio, does that help me?
Title: Re: [C/C++] Mixing C and C++
Post by: Doctorandus_P on November 01, 2021, 02:01:56 pm
(Nearly ?) all C source code should compile just fine with C++ compiler.

Title: Re: [C/C++] Mixing C and C++
Post by: SiliconWizard on November 01, 2021, 05:38:29 pm
There was already a thread about this: https://www.eevblog.com/forum/programming/crazyness-c-and-c-mixing/ (https://www.eevblog.com/forum/programming/crazyness-c-and-c-mixing/)
in which the topic was discussed in details. No need to go at it all over again.
Title: Re: [C/C++] Mixing C and C++
Post by: Simon on November 01, 2021, 07:11:46 pm
Thank you, I will take a look.