Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Creating a makefile

For the purpose of this tutorial, you were instructed to create a C++ Project which requires you to create a makefile.

To create a makefile:

  1. In the Project Explorer view, right-click the HelloWorld project folder and select New > File.
  2. In the File name box, type makefile.
  3. Click Finish.
  4. Type the gnu make instructions below in the editor. Lines are indented with tab characters, not with spaces.

  5. all: hello.exe

        rm main.o hello.exe

    hello.exe: main.o
        g++ -g -o hello main.o

        g++ -c -g main.cpp

  6. Click File > Save.

Your new makefile, along with your main.cpp file are displayed in the Project Explorer view. Your project now contains main.cpp and makefile. You can now build your HelloWorld project.

NEW Click here to see an illustration.

Next icon Next: Building your project

Back icon Back: Creating your C++ file

Related concepts
Code entry

Related tasks
Working with C/C++ project files
Writing code

Related reference
C/C++ Projects view

IBM Copyright Statement

  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire