Thread: recompiling when moving source code?

  1. #1
    Registered User
    Join Date
    Oct 2017
    Posts
    22

    recompiling when moving source code?

    I am using Linux CentOS. I have copied my C source codes directory and my bin directory from my local computer to a server location and I ran those copied scripts (I changed my path also to find those copied scripts and not the original ones from my local computer).
    I forgot to recompile everything but the codes have been running because I have copied the bin directory too.

    The scripts have been running for a while and I am really tight with time so I wouldn't want to stop them to recompile everything but I am wondering is it necessary to recompile or it is okay to simply run the copied compiled files from /bin directory?

    Also, there is a lot of things done by these scripts, they are a part of a software so there is a chance that I will get bad results which I won't notice in case I did the wrong thing.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    27,269
    As long as there are no permission issues, where your C code is placed doesn't matter except during development (because you and your compiler toolchain need to know where it is!)

    What does matter for running the program is where the compiled program and any supporting dynamic libraries are. But even then, you could move your compiled program without a problem as long as you didn't hardcode any filesystem paths that it uses.
    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
    Registered User
    Join Date
    Dec 2017
    Posts
    719
    If you moved the code to another machine then overall it is best to recompile. However, if the machine and OS are essentially the same then it may be okay.
    The world hangs on a thin thread, and that is the psyche of man. - Carl Jung

  4. #4
    TEIAM - problem solved
    Join Date
    Apr 2012
    Location
    Melbourne Australia
    Posts
    1,859
    Maybe try the Linux room? You might get some better answers there
    Fact - Beethoven wrote his first symphony in C

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How can I change #define values without recompiling?
    By maryfsan in forum C Programming
    Replies: 5
    Last Post: 07-31-2014, 03:06 AM
  2. Moving code from main to function
    By Mentallic in forum C Programming
    Replies: 2
    Last Post: 10-16-2012, 11:55 PM
  3. Replies: 11
    Last Post: 04-18-2011, 05:44 PM
  4. Recompiling C after Oracle 9i upgrade?
    By marcusg in forum C Programming
    Replies: 2
    Last Post: 06-02-2005, 05:55 AM
  5. Moving code from C to C++
    By Elixia in forum C++ Programming
    Replies: 3
    Last Post: 06-07-2003, 08:34 PM

Tags for this Thread