0

I have two different projects in a single workspace and both projects are cpp projects. When I am calling cpp function from one project to another project but it is not working and showing undefined reference to Function Name. at the time of linking.

Calling file is in .c with project name ABC and definition file is .cpp with project name CDE

Please help

Prashant Mehta
  • 484
  • 2
  • 11
  • 30

1 Answers1

2

Your question is a bit vague but the problem could be name mangling. Put your C++ function in an extern "C" { ... } block in order to give it C linkage and prevent the compiler from mangling the name.

  • I have already tried this but still facing the same issue(Undefined Reference). will you please elaborate it more so that I can try again. – Prashant Mehta Apr 08 '15 at 05:52
  • So, perhaps the problem is in path where cpp -files located or incorrect run of compiler? – VolAnd Apr 08 '15 at 06:07