eclipes CDT : Creating a simple Standard C++ Project -- "Hello World on a Windows Platform"

Creating a simple Standard C++ Project -- "Hello World on a Windows Platform"

This section will use an example to create the familiar "Hello World!" C++ program. First, ensure that you have the CDT installed within Eclipse, as described above. Open a C/C++ Perspective and complete the following steps:

  1. In the C/C++ Projects View right click and select "New Project ..."
  2. Select "C++" in the left pane and the select "Standard Make C++ Project"
  3. Enter a name for the new project and select Finish. Note: you can determine the "Build Settings" from this dialog, but we will do so later, in the build section.
  4. In the C/C++ Projects View right click and select "New" > "Simple" > "File". Name your file hello.cpp
  5. Repeat the previous step and name the second new file "makefile".
  6. Copy the following text into the "hello.cpp" file:
    #include <stdio.h>
    int main()
    {
    printf("Hello World/n");

    //block until user types something
    fgetc(stdin);
    return 0;
    }

    Now, save the file.

  7. Copy the following text into the "makefile" file:
    Remember that makefile requires that indented lines use a <tab> character and not spaces
    hello.exe : hello.o
    g++ -o hello.exe hello.o

    hello.o : hello.cpp
    g++ -c hello.cpp

    all : hello.exe
    clean :
    -rm hello.exe hello.o

    Now, save the file.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值