user3293434
user3293434

Reputation: 143

how to run the .o file after make

I have been trying to run a c++ program from https://github.com/rinon/Simple-Homomorphic-Encryption

As specified in the README I have run the following commands,

make

make test

make demo

Now, I have the following files in my directory,

zakirhussain@zakirhussain-K52F:~/Simple-Homomorphic-Encryption$ ls
circuit.cpp             demo_vote_counter.cpp  fully_homomorphic.cpp  main.o                 security_settings.h     test_suite.o  utilities.o
circuit.h               demo_vote_counter.h    fully_homomorphic.h    makefile               security_settings.o     type_defs.h
circuit.o               demo_vote_counter.o    fully_homomorphic.o    README                 test_fully_homomorphic  utilities.c
demo_fully_homomorphic  fully_homomorphic      main.cpp               security_settings.cpp  test_suite.cpp          utilities.h

Could someone help me with running demo_vote_counter.o file?

Upvotes: 14

Views: 78670

Answers (6)

Cuong Vo
Cuong Vo

Reputation: 672

I think I am late, but the code below maybe helpful for someone, I guess.

Using cd into your folder contains the c/c++ file, then compile it.

gcc my_test.c -o my_test

Complied file will be generated. Then still in same folder. Run the command.

./my_test

Upvotes: 4

KedarX
KedarX

Reputation: 781

As already mentioned in several other answers, you can execute a binary file and not the object file. However, Just in case, if what you want is to display the contents of object file in readable format?

$>objdump -d object_filename.o 

Upvotes: 3

Dan
Dan

Reputation: 1486

In this case the executable is called demo_fully_homomorphic, try

./demo_fully_homomorphic

Upvotes: 0

tebe
tebe

Reputation: 316

You can't run the object file. It has to be linked first to make an executable.

As I see there is a "demo_fully_homomorphic" "fully_homomorphic" and a "test_fully_homomorphic" in your directory. Those are your linked executables, you may execute them with ./[executable_name]

Upvotes: 0

Marc Claesen
Marc Claesen

Reputation: 17026

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).

Upvotes: 17

Devolus
Devolus

Reputation: 22084

You can not run a .o file. This is an object file and has to be linked into the final executable. A .o file is usually lacking additional libraries, which are added at the linking stage.

Looking at your outoput I would assume that one of demo_fully_homomorphic, test_fully_homomorphic or fully_homomorphic are the executables that you can run.

Upvotes: 10

Related Questions