How to call a cpp file from a c file




















The following example shows the various kinds of declarations and definitions that are allowed in a header file:. Skip to main content. This browser is no longer supported. Download Microsoft Edge More info. Contents Exit focus mode. Please rate your experience Yes No. Any additional feedback? Submit and view feedback for This product This page. Lets assume I have a few files: reflection. Does it have anything to do with the errors from question 1? Thanks in advance for the help, I hope i can fix this soon.

Improve this question. You need extern "C" in your header declarations. I did, and I get a different Error. Here is a working example that may be useful: stackoverflow. Add a comment. Active Oldest Votes. To solve the issue, you must declare the functions in both cases as extern "C". Improve this answer. Christophe Christophe Your C headers include C standard library headers, right?

You just broke those too. But this will bite you eventually. I disagree. My C headers usually do not include C standard library headers or similar. They then have the choice to put the ifdef Your email address will not be published.

Skip to content. Previous Post. Next Post. Hi Arne, thanks so much for writing. Naturally, this works only for non-member functions. If you want to call member functions incl. If you want to call overloaded functions from C, you must provide wrappers with distinct names for the C code to use. Final comment: if you have C headers that are not part of the standard library, we have somewhat different guidelines for you.



0コメント

  • 1000 / 1000