Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am tasked with adapting a boiler plate make file from a text book to be used with my project. I have 3 source files, Item.cpp Main.cpp and Item.h, and of course makefile.

I am lead to believe the reasoning for my make file not functioning correctly is having more than one source file where as the example had only one (Assignment1.cpp), here's the resulting error message.

Microsoft (R) Program Maintenance Utility Version 11.00.51106.1
Copyright (C) Microsoft Corporation.  All rights reserved.

NMAKE : fatal error U1073: don't know how to make 'Assignment01.obj'
Stop.

I have looked over some information regarding make files but most C++ is g++ related and no one seems to really use make files anymore and just lets their IDE take care of it.

# Assignment01 makefile

!include <"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include\win32.mak">
# !include <win32.mak> for Visual Studio 2010 or earlier
# Visual Studio 2012 may install this file inside C:\Program Files folder

all: Assignment01.exe

.cpp.obj:
  $(cc) $(cdebug) $(cflags) $(cvars) $*.cpp

Assignment01.exe: Assignment01.obj
  $(link) $(ldebug) $(conflags) -out:Assignment01.exe Assignment01.obj $(conlibs) 
share|improve this question

1 Answer

up vote 0 down vote accepted

The problem you are facing here is that you don't have source file "Assignment01.cpp" but, the corresponding .obj file is listed in your makefile. It seems like you have two source files. So, just list two corresponding object files (Item.obj Main.obj) in your link statement.

Example is as follows:

Assignment01.exe: Item.obj Main.obj
  $(link) $(ldebug) $(conflags) -out:Assignment01.exe Item.obj Main.obj $(conlibs) 

You need to verify this in your environment. I just typed this in.

Good luck.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.