I have a C++ VS2010 project. I want it to be pure C, so I will have a pure C library and a C++ file that will call that library.
- Is it possible? Will I have be able to pass data from the C part to C++?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes. See how to mix c and c++.
Of course, you could (probably) just compile the c code with a c++ compiler and save yourself a headache.
If you want to link object files compiled by a c compiler, you’ll need to use
extern "C" { }to declare the functions, so that they aren’t name mangled by the C++ compiler.It really depends on how you want to build your project. If you’re more specific, you’ll get better answers.