2003-11-28 21:50:02 +00:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
< html lang = "en" >
< head >
2004-05-15 20:50:33 +00:00
< meta http-equiv = "Content-Language" content = "en-us" >
< meta http-equiv = "Content-Type" content = "text/html; charset=UTF-8" >
< title > Creating your makefile< / title >
< link rel = "stylesheet" type = "text/css" href = "../help.css" >
2007-06-19 19:34:42 +00:00
< script language = "JavaScript" >
function newWin(url) {
window.open(url, 'install_cdt', 'width=750, height=700, menubar=no, toolbar=no, status=no, resizable=yes, location=no, scrollbars=yes');
}
< / script >
2003-11-28 21:50:02 +00:00
< / head >
< body >
2007-06-19 19:34:42 +00:00
< h1 > Creating a makefile< / h1 >
2003-11-28 21:50:02 +00:00
2007-06-19 19:34:42 +00:00
< p > For the purpose of this tutorial, you were instructed to create a C++ Project which requires you to create a makefile.< / p >
2003-11-28 21:50:02 +00:00
2007-06-19 19:34:42 +00:00
< p > To create a makefile:< / p >
2003-11-28 21:50:02 +00:00
< ol >
2010-03-31 01:34:27 +00:00
< li > In the < strong > Project Explorer< / strong > view, right-click the < strong > HelloWorld< / strong > project
folder and select < strong > New > File< / strong > .
< li > In the < strong > File name< / strong > box, type < strong > makefile< / strong > .< / li >
< li > Click < strong > Finish< / strong > .< / li >
2003-11-28 21:50:02 +00:00
< li > Type the gnu make instructions below in the editor. Lines are
indented with tab characters, not with spaces.< / li >
< blockquote >
< p >
< br >
all: hello.exe< br >
< br >
clean:< br >
rm main.o hello.exe< br >
< br >
hello.exe: main.o< br >
g++ -g -o hello main.o< br >
< br >
main.o:< br >
g++ -c -g main.cpp< br >
< / p >
< / blockquote >
2010-03-31 01:34:27 +00:00
< li > Click < strong > File >
Save< / strong > .< / li > < / ol >
2003-11-28 21:50:02 +00:00
< p > Your new makefile, along with your main.cpp file are
2009-06-16 21:38:17 +00:00
displayed in the Project Explorer view. Your project now
2003-11-28 21:50:02 +00:00
contains main.cpp and makefile. You can now build your HelloWorld project.< / p >
2009-06-16 21:38:17 +00:00
< p > NEW < a href = "javascript:void(0)" onClick = "newWin('../images/cdt_w_newmake02.png')" > Click here to see an illustration< / a > .< / p >
2003-11-28 21:50:02 +00:00
< p >
< a href = "cdt_w_build.htm" style = "text-decoration: none" >
2009-05-05 20:53:52 +00:00
< img border = "0" src = "../images/ngnext.gif" width = "16" height = "16" alt = "Next icon" > < / a >
2010-03-31 01:34:27 +00:00
< strong > < a href = "cdt_w_build.htm" >
Next: Building your project< / a > < a href = "cdt_w_build.htm" style = "text-decoration: none" > < / a > < / strong >
2003-11-28 21:50:02 +00:00
< / p >
< p align = "left" >
< a href = "cdt_w_newcpp.htm" >
2010-03-31 01:34:27 +00:00
< img border = "0" src = "../images/ngback.gif" width = "16" height = "16" alt = "Back icon" > < / a > < strong > < a href = "cdt_w_newcpp.htm" > Back: Creating your C++ file< / a > < / strong > < / p >
2003-11-28 21:50:02 +00:00
< p > < img border = "0" src = "../images/ngconcepts.gif" ALT = "Related concepts" width = "143" height = "21" >
< br >
< a href = "../concepts/cdt_o_projects.htm" > Project< / a > < br >
< a href = "../concepts/cdt_o_code_entry.htm" > Code entry< / a > < / p >
< p > < img border = "0" src = "../images/ngtasks.gif" ALT = "Related tasks" width = "143" height = "21" >
< br >
< a href = "../tasks/cdt_o_proj_files.htm" > Working with C/C++ project files< / a > < br >
< a href = "../tasks/cdt_o_write_code.htm" > Writing code< / a > < / p >
< p > < img border = "0" src = "../images/ngref.gif" ALT = "Related reference" width = "143" height = "21" >
< br >
< a href = "../reference/cdt_o_proj_prop_pages.htm" > C/C++ Projects view< / a > < / p >
< p >
2007-06-19 19:34:42 +00:00
< img src = "../images/ng00_04a.gif" ALT = "IBM Copyright Statement" >
2003-11-28 21:50:02 +00:00
< / body >
< / html >