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
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…