I am trying to use g++ to compile a .cc file, and I need it to link a .o file.
So I tried:
$g++ -o client -I../ipc -L../messages.o client.cc
/usr/bin/ld: error: ../messages.o: can not read directory: Not a directory
And I have tried:
$g++ -o client -I../ipc -l../messages.o client.cc
/usr/bin/ld: error: cannot find -l../messages.pb.o
$$ ls -l ../messages.o
-rw-r--r-- 1 hap497 hap497 227936 2010-02-03 22:32 ../messages.o
Can you please tell me how to link in a .o file?
Thank you.
An object file ( .o ) is not executable. You want to be running ./demo_fully_homomorphic (e.g. the file without extension). Make sure you have execute permissions ( chmod a+x demo_fully_homomorphic ). Show activity on this post.
A shared object file holds code and data suitable to be linked in two contexts. First, the link-editor can process it with other relocatable and shared object files to create other object files. Second, the runtime linker combines it with a dynamic executable file and other shared objects to create a process image.
No. They are not platform independent.
It does this by turning the C source code into an object code file, which is a file ending in ".o" which contains the binary version of the source code. Object code is not directly executable, though.
$g++ -o client -I../ipc client.cc ../messages.o
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With