Question

I am working with a different compiler CC. It doesn't work like GCC.

When I was using GCC, I can do "gcc -o exe_filename source_filename" and the output would be a exe file.

When I use CC, I need 2 steps. First I compile the source files (suppose it involve a .c and a .h file ) and it create a .lis file and a .obj file. Then I do a link command which created a .exe file.

What is the relationship between LIS, OBJ and EXE files? I ask this because I wonder which files do I need if I want to use the exe in another machine without including unnecessary files. If LIS and OBJ were only used for compilation, I don't need it in another machine.

Was it helpful?

Solution

The compiler takes C files (and includes H files as referenced) and produces object (OBJ) and listing (LIS) files. The object file contains the code and data, but has unresolved external references. The listing typically includes line numbers, error and warning messages, and optional sections such as a type and variable cross-reference.

The linker combines object files and resolves external references to libraries. The result is an executable (EXE) image. (Or shareable image when creating libraries.)

Only the executable file needs to be copied from one system to another to run the application. The listing may be useful for interpreting error messages as it provides the properly correlated line numbers. The object could be useful if the application needs to be relinked due to changes in libraries, particularly if the target system has older versions than the original system.

OTHER TIPS

the OBJ files are the compiled C files in a format that they can be "Linked" together by a linker and turned into an EXE.

Compile -> OBJ -> Link -> EXE

the LIS file is just informational output of the C that the compiler ends up compiling.

All you need once compiled and linked is the EXE

You don't need the other files. The exe will work fine by itself.

I don't have much idea on LIS. But the difference between OBJ and EXE is OBJ file may contain unresolved symbols and in EXE file all symbols are linked and resolved.

If another machine also has same hardware then u can use direct exe to run else you have to cross compile

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top