#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    17
    Rep Power
    0

    How do pro C programmers compile code?


    I'm reading a book (Head first C) because that's how I'm learning C programming. In one of the chapters it talks about making small tools and by that they use the command prompt to compile their code. Now, I'm confused when dealing with the command prompt because I never delt with it before. So I'm afraid that this book will keep on talking about stuff like that and get me confused.

    I use Visual Studio to compile my code. Is that ok? Can I still make complex programs with it or do I need to know how to compile C code in the command line.
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Location
    Iran
    Posts
    149
    Rep Power
    139
    The answer to the question depends on many factors such as:

    - On which platform do you plan to work (Windows, Linux/Unix, ...)

    - What do you want to do in terms of maintenance/development

    - How many people are working on that project

    - What are the tools already used for compiling and version management by the project team?

    - etc.

    Anyway, IMHO, anybody should be familiar with command line environment, because it is really powerful and gives you many possibilities, particularly when you start scripting in parallel. In many systems, you don't even have a GUI and the command line (shell) is the only thing you have. So, yes, I think you have to understand and learn it.
    Originally Posted by miz656
    ... So I'm afraid that this book will keep on talking about stuff like that and get me confused.
    Well, if it is a book that is written for beginners, I don't see why you shouldn't be able to continue, just read the book's chapters according to the order that the author recommends.
    Originally Posted by miz656
    ... I use Visual Studio to compile my code. Is that ok? ...
    it is a well known tool, but again, it depends on what you want to do in the future and for which platform you plan to develop in C (Linux? Windows?, ...)


    Regards,
    Dariyoosh
  4. #3
  5. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,379
    Rep Power
    1871
    You can carry on using visual studio to compile your programs if you want.

    > Can I still make complex programs with it or do I need to know how to compile C code in the command line.
    It depends how curious you are to find out new things.

    Sometimes, it's just useful to be able to open a simple text editor, write a simple program and be able to simply type at the command prompt
    cl prog.cpp
    and have it produce prog.exe, without all the hassle of creating a new project in vs, along with all the other baggage.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    17
    Rep Power
    0
    I'm sorry. I'm a fourteen year old who is just testing and experiencing.

    Let me rephrase the question. Can I do the same things with Visual Studio when using the command prompt?(if not, more advanced things in Visual Studio)

    In the C book it talks about making some type of GPS and then gives an example using the > operator in the command line.

    Thanks again for answering me
  8. #5
  9. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,379
    Rep Power
    1871
    > In the C book it talks about making some type of GPS and then gives an example using the > operator in the command line.
    The > operator on the command line is output redirection.

    So
    myprog.exe
    just displays on the console, whereas
    myprog.exe > file.txt
    puts all the output in file.txt

    Now it may be possible on one of the dialogs visual studio provides where you can achieve the same thing.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper

IMN logo majestic logo threadwatch logo seochat tools logo