Linked Questions
19 questions linked to/from What's an object file in C?
35 votes
4 answers
21k views
What is "object" in "object file" and why is it called this way? [duplicate]
I was asked a question: "What is an 'object file'?". After looking at Wiki, I only know that it contains objects. But what are those objects and why someone called them that way?
0 votes
1 answer
3k views
What are .o files and to open them on windows? [duplicate]
I'm a beginner in programming, I wonder what is inside the .o files and want to see it, but can't open the files in windows because they give some output with unrecognized symbols. Please suggest ...
1 vote
1 answer
1k views
What is .c.obj / .cpp.obj file? [duplicate]
I got these console output while compilation via GCC. Building CXX object xxxxxxx.cpp.obj What are the .cpp.obj files? Are they the object file? Do the same as the .o file?
290 votes
10 answers
204k views
Assembly code vs Machine code vs Object code?
What is the difference between object code, machine code and assembly code? Can you give a visual example of their difference?
47 votes
3 answers
34k views
How does C++ linking work in practice? [duplicate]
How does C++ linking work in practice? What I am looking for is a detailed explanation about how the linking happens, and not what commands do the linking. There's already a similar question about ...
9 votes
3 answers
19k views
My C program fails to run with `cannot execute binary file: Exec format error`
I'm just starting with C. I'm trying to compile the below code and execute it, but I get an error. Also running size shows nothing in BS or data stacks? #include<stdio.h> /* test.c: My first ...
3 votes
4 answers
5k views
How to call a C program inside bash script and store its return value to a variable?
I have bash script where I ask the user for some inputs, and then I want to call a C program a few times, and sum the return value. Please note that the main function inside my C program has some ...
1 vote
3 answers
12k views
When compiling a C program, i get this error: hello: no such file or directory
I have compiled other programs before but, for some reason, I can't work anymore. I have a mac Here's my code. Its purpose is to take three numbers and find the average. #include <stdio.h> int ...
1 vote
1 answer
5k views
Binary files format (ARM GCC)
what contains a binary file which come from a ARM GCC for ARM devices? Is there inside it some information about destination address which write to? Or just native, pure, content of program without ...
2 votes
1 answer
4k views
Why do I need to include .o files when compiling?
When I compiled my program and ran it, I got a a symbol lookup error. I was doing this: $ gcc -o parts parts.c -lnettle $ ./parts $ ./parts: symbol lookup error: ./parts: undefined symbol: ...
1 vote
1 answer
2k views
Clang compilation : "Cannot execute binary file"
I am new to the clang++ compiler flags. I have an issue regarding compilation. Here is my cmd: clang++ -I ../llvm-project/llvm/include -I ../llvm-project/clang/include -I ../llvm-project/build/...
0 votes
1 answer
1k views
How is C++ compiled
I am working on some (very) low level programming but not everything is completely clear to me. I start by creating a .cpp (or .c) file which is run through gcc to create an elf or object file but ...
-1 votes
1 answer
1k views
Cannot execute output files( able to execute a.out but not when I make an output file with "make")
Question has been solved, visit the bottom part of this paragraph for details. I have a program: foo.cpp and bar.cpp and have created a Makefile to compile them. This is how it(Makefile) looks: CC=g++ ...
1 vote
1 answer
437 views
What exactly is an Object code after a compiled state?
I know object code is the code after the compilation phase which is present in a object file(eg:aaa.obj). What is this file? Contains Machine Instructions? If so why can't I see any 0's and 1's in ...
0 votes
3 answers
768 views
Installing a software using Makefile
I am trying to install a C software and then make a test program that uses it. The software consists of three files: x-as-func.c x-as-func.h y.h (this has only define statements) the executable x In ...