问题
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