CS-FreeStyle / 10000-How-To-Do-in-CS

1 stars 0 forks source link

undefined reference because of C and C++ mixing programming #86

Open liuty10 opened 4 years ago

liuty10 commented 4 years ago

The name of functions are changed when you compile call C functions in C++ file. That's why you can't find the corresponding name after mangling

https://isocpp.org/wiki/faq/mixing-c-and-cpp

https://embeddedartistry.com/blog/2017/05/01/mixing-c-and-c-extern-c/

https://stackoverflow.com/questions/6423340/undefined-reference-to-a-function

use "nm" to check the symbols in object file: https://stackoverflow.com/questions/3880924/how-to-view-symbols-in-object-files