Running My Program

This is a discussion on Running My Program within the C Programming forums, part of the General Programming Boards category; I just wrote my first program with the help of some of yall on this forum. I have another maybe ...

  1. #1
    Registered User
    Join Date
    Sep 2004
    Posts
    24

    Question Running My Program

    I just wrote my first program with the help of some of yall on this forum. I have another maybe stupid question. How do i run my program outside of the compiler. For example if i wanted to email it to my buddy to show him and he doesnt have the compiler how do you run it??

  2. #2
    Registered User Draco's Avatar
    Join Date
    Apr 2002
    Posts
    463
    what system are you on? When fully compiled the program will be in an independent executable that you can email to your friend and if he has the same OS, he can then run.

  3. #3
    Registered User
    Join Date
    Sep 2004
    Posts
    24
    xp..so all i have to do is email it to him and he can run it?

  4. #4
    C Programmer Stack Overflow's Avatar
    Join Date
    Apr 2004
    Posts
    477
    Greetings Jeff,

    When you compile your source code successfully, your program writes to the current build directory in either the Debug or Release folder. Usually, the program has the same name as your project, so if you called it "My Program", an executable of "My Program.exe" will be in either of the folders.

    Once you find it, just execute it from console, or double click on it depending on what the programs content contains.


    Hope this helps,
    - Stack Overflow
    Segmentation Fault: I am an error in which a running program attempts to access memory not allocated to it and core dumps with a segmentation violation error. This is often caused by improper usage of pointers, attempts to access a non-existent or read-only physical memory address, re-use of memory if freed within the same scope, de-referencing a null pointer, or (in C) inadvertently using a non-pointer variable as a pointer.

  5. #5
    Registered User
    Join Date
    Sep 2004
    Posts
    24
    Ok i found it but when i try to open it it gives me an error message that says unable to located because something cant be found. When i send it via email and my buddy tries to open it, it tries to open in windows media player?? Any suggestions?

  6. #6
    C Programmer Stack Overflow's Avatar
    Join Date
    Apr 2004
    Posts
    477
    That sounds strange.

    What file extention is it, e.g., .exe|.wmv|etc...?
    Segmentation Fault: I am an error in which a running program attempts to access memory not allocated to it and core dumps with a segmentation violation error. This is often caused by improper usage of pointers, attempts to access a non-existent or read-only physical memory address, re-use of memory if freed within the same scope, de-referencing a null pointer, or (in C) inadvertently using a non-pointer variable as a pointer.

  7. #7
    Registered User
    Join Date
    Sep 2004
    Posts
    24
    its an .exe file.... the error message said that "this application has failed to start because cygwin.dll was not found. Re installing the application may fix this problem." i reinstalled cygwin but why should that matter if its a program that i created. It shouldn't need anything to run. Maybe this isnt the program though because its a diffrent name than what i called it in my compiler. but its the only one i found that wasnt their before i compiled my program...That make any sense??

    And i cant find a debug or release folder.
    Last edited by Jeff; 09-01-2004 at 05:04 PM.

  8. #8
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,164
    Maybe you can compile it with something like a -static option so it doesn't depend on any dll's.
    If you understand what you're doing, you're not learning anything.

  9. #9
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,246
    There is no static version of the cygwin library. Try compiling passing the -mno-cygwin parameter. I think this tries to cross compile with the MSVC runtime.

    Or you can just get yourself a better windows compiler I love gcc on linux, but just find that it's too much of a hassle on windows.

  10. #10
    Registered User
    Join Date
    Sep 2004
    Posts
    24
    Well the class im taking requires this compiler because a professor here wrote it. I emailed him and he said to add the path for Cygwin (e.g., C:\cygwin\bin) to your PATH variable. But i dont know how to do this. Can anyone help with this?

  11. #11
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,164
    Right-click My Computer, choose Properties, go to the Advanced tab, click the Environment Variables button...you should be able to figure it out from there.
    If you understand what you're doing, you're not learning anything.

  12. #12
    Registered User
    Join Date
    Sep 2004
    Posts
    24
    Ok well i figured out how to do this but it still didnt work. Any other suggestions? How do i do this ?? Try compiling passing the -mno-cygwin parameter. I think this tries to cross compile with the MSVC runtime.

  13. #13
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,246
    It just means you pass that to the compiler when you compile.

    Ex:
    gcc -c -omyprogram.exe myprogram.c -mno-cygwin

  14. #14
    Registered User
    Join Date
    Sep 2004
    Posts
    24
    that didnt work either

  15. #15
    Obsessed with C chrismiceli's Avatar
    Join Date
    Jan 2003
    Posts
    501
    What is happening is that your compiler uses its own dlls instead of the ones that are there by windows. If you want to use those, ie. make it usable by anyone with windows, you need a different compiler.
    Help populate a c/c++ help irc channel
    server: irc://irc.efnet.net
    channel: #c

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program running long
    By smarta_982002 in forum Windows Programming
    Replies: 3
    Last Post: 03-27-2008, 05:24 AM
  2. Running my program in the background
    By shoobsie in forum Windows Programming
    Replies: 4
    Last Post: 10-09-2005, 02:38 AM
  3. Replies: 3
    Last Post: 09-05-2005, 08:57 AM
  4. Why is my program running away?
    By badkitty in forum C++ Programming
    Replies: 4
    Last Post: 09-19-2001, 04:27 PM
  5. Running program
    By muffin in forum C Programming
    Replies: 5
    Last Post: 08-30-2001, 10:57 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21