Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to run the .o file after make

Tags:

c++

c

makefile

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?

like image 625
user3293434 Avatar asked Mar 07 '14 13:03

user3293434


People also ask

Can you run a .O file?

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

How do I open a .O file?

The best way to open an O file is to simply double-click it and let the default assoisated application open the file. If you are unable to open the file this way, it may be because you do not have the correct application associated with the extension to view or edit the O file.

What are .o files in a Makefile?

.o denote "object-files", these are files compiled from source but not yet linked into an executable or a library. In your make-file, i.e. main.o : main.cpp. says that main.o will be created from main.


1 Answers

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
like image 170
Cuong Vo Avatar answered Oct 05 '22 23:10

Cuong Vo