Thread: confusion in linking process

  1. #1
    Registered User
    Join Date
    Feb 2009
    Posts
    9

    confusion in linking process

    when we run the command to compile a program, the results we get are, a .obj file and .exe file.

    as far as I know, .obj file is created by compiler and .exe file by linker however, since the .exe file also created at the same time hence it make me thinking about that the linker is also called when we run the command for compilation.

    is that so?

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Maybe the command that you are running is named "build", since "build" is often used to mean "compile and link". On the other hand, sometimes people use "compile" when they mean "compile and link".
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Beyond what Laserlight says, many compilers (including Turbo C, gcc and MS Visual Studio) support "linking using the compiler", where if you do NOT specify a flag (-c or similar) to say "only compile this, don't link it", the compiler starts the linker after it has finished compiling the source code. So essentially, the linker is being run in a separate process, but it is done as part of one single command - the compile command.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. init adopts zombie process?
    By password636 in forum Linux Programming
    Replies: 4
    Last Post: 07-01-2009, 10:05 AM
  2. Replies: 3
    Last Post: 10-15-2008, 09:24 AM
  3. Problem with forking a process
    By Unitedroad in forum C Programming
    Replies: 10
    Last Post: 10-04-2007, 01:43 AM
  4. process programming
    By St0rM-MaN in forum Linux Programming
    Replies: 2
    Last Post: 09-15-2007, 07:53 AM
  5. ICMP packet / process confusion
    By eth0 in forum Networking/Device Communication
    Replies: 0
    Last Post: 05-24-2005, 04:17 PM