obj Compiling.Ĭl /c /EHsc /Fo$(DIR_INTERMEDIATE_X86)\ /I$(DIR_INCLUDE) $< # create directories and build application # delete output exist $(DIR_BIN) rmdir /S /Q exist $(DIR_INTERMEDIATE) rmdir /S /Q $(DIR_INTERMEDIATE) # create output not exist $(DIR_BIN_X86) mkdir not exist $(DIR_INTERMEDIATE_X86) mkdir $(DIR_INTERMEDIATE_X86) $(DIR_INTERMEDIATE_X86)\printx.obj: $(DIR_SRC)\printx.cppĬl /c /EHsc /Fe$(DIR_INTERMEDIATE_X86)\printx.obj /I$(DIR_INCLUDE) $(DIR_SRC)\printx.cpp $(DIR_INTERMEDIATE_X86)\main.obj: $(DIR_SRC)\main.cppĬl /c /EHsc /Fe$(DIR_INTERMEDIATE_X86)\main.obj /I$(DIR_INCLUDE) $(DIR_SRC)\main.cpp We can separate compiling from linking in two steps - compiling source files into object files and linking object files into executable.ĭIR_INTERMEDIATE_X86 = $(DIR_INTERMEDIATE)\x86 \sĬ:\DEVELOPMENT\RESEARCH\C++\HelloWorld\build>cd ".\bin\x86"Ĭ:\DEVELOPMENT\RESEARCH\C++\HelloWorld\bin\x86>helloworld.exeĬ:\DEVELOPMENT\RESEARCH\C++\HelloWorld\bin\x86> Upon nmake call, we have following files in our project directory:Ĭ:\DEVELOPMENT\RESEARCH\C++\HelloWorld\build>nmake allĬl /EHsc /Fe.\bin\x86\helloworld.exe /I.\include. Microsoft (R) Incremental Linker Version 9.01Ĭ:\DEVELOPMENT\RESEARCH\C++\HelloWorld>mainĬompiler creates obj file and automatically invokes the linker after compiling unless the /c option is used. Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 9.01 for 80x86Ĭ:\Program Files\Microsoft Visual Studio 10.0\VC\include\xlocale(323) : warningĬ4530: C++ exception handler used, but unwind semantics are not enabled. Microsoft (R) Program Maintenance Utility Version 9.01Ĭopyright (C) Microsoft Corporation. Setting environment for using Microsoft Visual Studio 2010 x86 tools.Ĭ:\DEVELOPMENT\RESEARCH\C++\HelloWorld>where nmakeĬ:\Program Files\Microsoft Visual Studio 10.0\VC\bin\nmake.exeĬ:\DEVELOPMENT\RESEARCH\C++\HelloWorld>where cl.exeĬ:\Program Files\Microsoft Visual Studio 10.0\VC\bin\cl.exeĬ:\DEVELOPMENT\RESEARCH\C++\HelloWorld>where link.exeĬ:\Program Files\Microsoft Visual Studio 10.0\VC\bin\link.exeĬ:\DEVELOPMENT\RESEARCH\C++\HelloWorld>nmake
C:\DEVELOPMENT\RESEARCH\C++\HelloWorld>setenv x86