Questions tagged [object-files]

An object file is the real output from the compilation phase.

An object file is the real output from the compilation phase. It's mostly machine code, but has info that allows a linker to see what symbols are in it as well as symbols it requires in order to work. (For reference, "symbols" are basically names of global objects, functions, etc.)

A linker takes all these object files and combines them to form one executable (assuming that it can, ie: that there aren't any duplicate or undefined symbols). A lot of compilers will do this for you (read: they run the linker on their own) if you don't tell them to "just compile" using command-line options. (-c is a common "just compile; don't link" option.)

293 questions
0
votes
1 answer

When/why are libstdc++ and libc++ symbols incompatible?

Setup: test.cpp #include #include void common_config_file_iterator(const std::set& allowed_options) {} include.cpp #include #include void common_config_file_iterator(const std::set&)…
MCCCS
  • 1,002
  • 3
  • 20
  • 44
0
votes
0 answers

Linking object files to executable not working

I am trying to compile an example from dlib.net using g++. I find that directly compiling the example into an executable works fine using: g++ -std=c++11 -O3 -I/usr/lib /usr/lib/dlib/all/source.cpp -lpthread -lX11 optimization_ex.cpp -o…
mwater
  • 111
  • 2
0
votes
1 answer

Issue with Linking Python C Extension to Another Library

I am in the process of developing a Python extension to allow a script running on a Raspberry Pi to control a sensor. The sensor manufacturer provided my organization with the source code to their C API, and I am trying to create a set of bindings…
SquawkBirdies
  • 157
  • 2
  • 13
0
votes
0 answers

OMP parrallel being ignored in object file

NOTE: I do not understand object files, linking, or make files very well. I only understand enough to get a program running I'm working on a GPU accelerated version of a previous project of mine that works with no problems. I currently am testing a…
0
votes
1 answer

How to link objects in different directories without makefiles?

I have 3 directories, src, lib, and include. In include I have header file header3.h. Its code is as follows: //header3.h extern void change(int *a); In lib I have file change4.c, which contains: //change4.c #include #include…
user9914667
0
votes
1 answer

Extract Raw Machine Code of Function From .o Object File?

How can I extract the raw machine code of a function from a .o object file? Built from gnu c++ using g++. File format is 32-bit relocatable LSB ELF, architecture i386. Any thoughts? Thanks in advance
user5718553
0
votes
0 answers

Template objectcode duplication

First: No, I am not asking about template specializations. Assume the following example: I have a header file with a generic method: template T foo(T bar) { return bar; } In a second file, called file1.cpp I use that method as…
Felix
  • 6,885
  • 1
  • 29
  • 54
0
votes
1 answer

Creating 16-bit .COM executables files using gcc

Is there a way to create 16-bit .COM executables (DOS) using some gcc distribution for windows (for example MINGW)?
MRalwasser
  • 15,605
  • 15
  • 101
  • 147
0
votes
0 answers

How to recover the flags: EXEC_P, HAS_SYMS, D_PAGED

I am coding the function objdump and I would like to know how to recover the flags (HAS_SYMS, D_PAGED) with their addresses. where is the HAS_SYMS,D_PAGED flags in the elf.h structure ?
user7275929
0
votes
1 answer

Linking 2 object files in c to create an executable

I am having an issue with a makefile for something I am making. My makefile looks like this bag: main.o bow.o gcc bow.o main.o -o bag main.o: main.c bow.h gcc -Wall -ansi -pedantic main.c -o main.o bow.o: bow.c bow.h gcc -Wall -ansi…
Clayton D
  • 37
  • 7
0
votes
1 answer

Cant read file name when Input through cmd in C ( through args[1] )

This is how I am reading my text files in cmd. It is a constraint. >gcc -std=c99 myproject.c -o myproject >myproject<1.txt What I'm trying to achieve is the file name "1.txt" as a string so that I can read the number for lines in the file. I looked…
0
votes
2 answers

arm - how to check endianness of an object file

Using objdump, how do you check if an .obj is little- or big-endian?
Bob
  • 4,576
  • 7
  • 39
  • 107
0
votes
1 answer

How to generate CFG for non executable binary files

I want to generate a control-flow graph for non-executable binary files. The objective is to perform static analysis on the generated binary files of Linux kernel. Is there any tool which can do this? Tools I found by searching are only for…
0
votes
1 answer

Linking an Unused Object File Breaks the Program

As a newbie to gcc and MCUs world, I am seeing a strange behavior I hope someone can help me with. I can create and execute a simple application for my armv7e-m board (CC3220S_LAUNCHXL) without any problem. However when I link an object file which…
Aydin
  • 13
  • 3
0
votes
2 answers

How to properly make a object file from header file (using an I2C board with a debian linux machine)

I have some source files that previously have been compiled for X86 architecture. Now I need to compile them for ARM architecture. When I try to use something like g++ -c -x c++ foo.h gcc -c -x c foo.h it only gives me few instructions. I believe it…
Nima
  • 13
  • 1
  • 8