Binary compatibility over what range of machines?

后端 未结 2 662
Happy的楠姐
Happy的楠姐 2020-12-11 19:37

I wrote a simple program in C and compiled it using GCC on Ubuntu. Will this file work on another machine?

  • What are the contents of the output binary, and its
2条回答
  •  暖寄归人
    2020-12-11 20:22

    The a.out (.o) files work on Unix-like OS machines. (Details of OS given above by @Nicholas Wilson)

    The .o includes all the libraries that are mentioned in .c file. A copy of the called function is copied from the library and made into .o file along with the code given in .c file.

    Again you compile the .o file to get an executable.

    Use of .o file is, if you are working on a big project where each department has their own source files (.c) and need to make a single executable. You can get it by compiling the .c files. After compiling you get .o files. Now, you can combine all these .o files to give a single executable.

提交回复
热议问题