丁霄's profile霄霄PhotosBlogListsMore Tools Help

Blog


    October 06

    在Cygwin环境下进行gcc编译

    1.首先安装Cygwin,通过网络在线安装,在选择安装扩展包gcc包。

    2.之后经过长时间等待,Cygwin安装完毕。

    3.在Windows系统环境变量中添加PATH变量,PATH变量一般系统中都会有,需要在添加Cygwin\bin值。

    4.启动Cygwin。

    5.通过在bash中输入pwd查看当前目录,在home文件夹下建立自己的源文件目录。

    6.如下图,在目录中建立1.c源文件。

    1

    7.在1.c中输入下列代码:

    #include <stdio.h>

    int main(void)
    {
      printf("*****************\n");
      printf( "Hello World!\n");
      printf("Jack Ding\n");
      printf("*****************\n");
    }

    8.保存1.c,在 bash环境中输入:gcc 1.c –o 1。如下图

    2

    9.编译通过后,在原目录下会生产1.exe。

    10.在bash下输入:  ./1 ,可执行1.exe,如下图

    3

    11.在Cygwin下gcc编译正常。

    Comments

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    Trackbacks

    The trackback URL for this entry is:
    http://xiaoxiao19811023.spaces.live.com/blog/cns!355A9AB9A67245EA!540.trak
    Weblogs that reference this entry
    • None