I have a problem with .o file in linux as follow:
I have Visual.cpp which call function ECL_Drawrect() and this function is defined as:
#define ECL_Drawrect ECL_bDrawrect
In my Visual.cpp I also include "ecl.h" as:
#include "ecl.h"
int main() {
ECL_Drawrect (0,0,20,20,false);
return 0;
}
The problem is that the function ECL_bDrawrect is in the ecl.o file and i don't know how to link it to use the function mentioned above.
After some research I figured out and setup as follow:
g++ Visual.cpp -o Visual /usr/include/ecl.o
The ecl.o path also incluced in my project and when I compiled i get this error:
**** Build of configuration Debug for project Visual ****
make all
Building file: ../src/Visual.cpp
Invoking: GCC C++ Compiler
g++ -m32 -O0 -g3 -Wall -c -fmessage-length=0 /usr/include/ecl.o -MMD -MP -MF"src/Visual.d" -MT"src/Visual.d" -o "src/Visual.o" "../src/Visual.cpp"
g++: /usr/include/ecl.o: linker input file unused because linking not done
Finished building: ../src/Visual.cpp
Building target: Visual
Invoking: GCC C++ Linker
g++ -m32 -o "Visual" ./src/Visual.o
/usr/bin/ld: ./src/Visual.o: in function main:../src/Visual.cpp:7: error: undefined reference to 'ECL_bDrawrect'
collect2: ld returned 1 exit status
make: *** [Visual] Error 1
**** Build Finished ****
I don't know whether the link is correct or not? How can I link this ecl.o file in properly way?
p/S: I'm using eclipse CDT in ubuntu 11.04 64-bit and the ecl.o is for 32-bit, that's why I have to put -m32 to g++.
ecl.ofile doing in/usr/include???