Link object file to my project Eclipse CDR

◇◆丶佛笑我妖孽 提交于 2019-12-29 01:42:09

问题


I'm working on a project from school, and we were given a .o and a corresponding .h file. We need to use several functions from the .o file in our .c program. Just placing it in the same directory doesn't work. I tried to look for something like this in the project properties, but no good. I keep getting ../code_files/Search.c:116: undefined reference to 'reportError'

I'm using Eclipse (Juno) CDT, gcc MinGW under Windows 7

I know it's possible to include .a files, but I couldn't find any indication on how to include a .o file #include "ErrorHandle.h" is included in the main c file.

Anyone knows how to include a .o file to a project? Thanks!


回答1:


I found this answer:

I tried doing something similar, only I didn't think of the miscellaneous thing




回答2:


You can trivially turn the .o into a .a with ar cvs library.a object.o, and then add the .a to your project.



来源:https://stackoverflow.com/questions/11810701/link-object-file-to-my-project-eclipse-cdr

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