Adding object file to cpp code in eclipse

此生再无相见时 提交于 2019-12-29 02:20:39

问题


I followed the ways mentioned in Link object file to my project Eclipse CDR

My main function is in cpp code and from that I wish to call a c-function. So for that I created the object file (.o) from the c-code using

gcc -c -fpic mycode.c

This gave me a ".o" file which I wanted to link to the cpp code. I created a header file with reference to http://www.parashift.com/c++-faq/include-c-hdrs-nonsystem.html

Header file was declared as an extern in my cpp code. The header file contains to function from the c-code, that function was declared as an extern in header file.

After doing this when I do make for my entire project I am getting error as "undefined reference" to that c-function name

来源:https://stackoverflow.com/questions/25866628/adding-object-file-to-cpp-code-in-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!