Menu

bloodshed help

Wander
2008-10-02
2012-09-26
  • Wander

    Wander - 2008-10-02

    Hello Im trying to teach myself C programming. Im using the dev-c++ bloodshed program. Well the problem im having seems to be two sided first of the program i wrote the classic hello world code

    include <stdio.h>

    int main(void)
    {
    printf("Hello, World/n");
    return 0;
    }

    compiles and when i hit run the dos window pops up but goes away to quick (if that windows not called dos please correct me) and i cant find the hello.obj file

    so i guess what im asking is there a way to set bloodshed for c are am i doing something wrong?

     
    • cpns

      cpns - 2008-10-03

      > Also in regards to the window closing the book makes
      > no mention to it closing so yes i was surprised lol.

      That's because it's an operating system issue, and the book is about C programming not how to use your computer's operating system.

      I am being somewhat unfair perhaps; some IDE's will execute code in a console wrapper so that the program runs as a child process and so does not own the window and so it does not close. Dev-C++ does not do that, even though it is an obvious problem, no one ever chose to fix it.

      If you were to run your console program from a Windows command shell session, the window will not close because it runs as a child process. Most real programs are either interactive by nature, or are intended to run to completion without manual intervention so in these cases this kludge solution is not required.

      Clifford

       
    • Wayne Keen

      Wayne Keen - 2008-10-02

      Your exact question is answered in the thread titled (not accidentally) "Please Read Before Posting a question". It is also answered in the FAQ.

      Please get in the habit of taking a moment to look around and trying to find something for yourself before asking a question.

      Wayne

       
      • Wander

        Wander - 2008-10-02

        I apologize for my moment of stupidity. I am not new to forums are being polite and i do plan on visiting these forums for help and hopefully as my skills evolve give advice. I see the answer for the window staying open but i couldn't seem to find a answer to why i can find my obj files. if i am over looking this im sorry if not could you please help i have since got that program to work along with several other small ones but the obj location still baffles me, and again i apologize

        The Wander

         
    • Wayne Keen

      Wayne Keen - 2008-10-03

      The obj files are automatically deleted.

      Why are you wanting to find them? Are you looking to do a manual link?

      Wayne

      p.s. It is not a DOS window - though I slip up from time to time and call
      it that myself.

       
    • cpns

      cpns - 2008-10-03

      Object files are not deleted after a build. Wayne must be thinking of something else.

      In GNU object files have a .o extension not .obj, so you should be looking for "hello.o".

      However the object file is an intermediate file, the file you execute will be called hello.exe and I suspect that that is what you were after. An object file is compiled code that is not linked to any necessary libraries or other object files. The .exe file is the complete linked program.

      This might help: http://sourceforge.net/forum/message.php?msg_id=2670009

      With respect to the window disappearing, in a GUI environment like Windows, when a program terminates, the OS closes its window. This is normal behaviour, it happens to every program, but when people write their own code they are always surprised! Your code merely needs some sort of interactivity to cause it to wait for user inpur before closing.

       
    • Wander

      Wander - 2008-10-03

      Thanks for all the useful info, the reason i was looking for the obj file is alot simpler though. The book im using to teach my self has a test section and it asks you to locate that file then open it in notepad are another text editor. Also in regards to the window closing the book makes no mention to it closing so yes i was surprised lol. thanks again for all the help

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.