krotkruton
Programmer
I've had some experience (CS classes) with UNIX based C++, but now that I'm away from school, I started working with MS VC++ because I couldn't get anything else working. Anyway, I can't figure out how to set up a makefile in VC++.
Here's a makefile I modified from a sample I found on the web.
#############################################################################
# Makefile for building barmonkey
# Modified by Kruton 01/02/05
# Project: barmonkey
# Template: app
#############################################################################
####### Compiler, tools and options
CC = cl
CFLAGS = -nologo -W3 -O2 -GX
INCPATH = -I"$(QTDIR)\include"
LINK = link
LFLAGS = /NOLOGO /SUBSYSTEM:windows
LIBS = $(QTDIR)\lib\qt.lib user32.lib gdi32.lib comdlg32.lib wsock32.lib
MOC = moc
####### Files
HEADERS = inventory.h \
drinks.h \
users.h
SOURCES = inventory.cpp \
drinks.cpp \
users.cpp \
barmonkey.cpp
OBJECTS = inventory.obj \
drinks.obj \
users.obj \
barmonkey.obj
SRCMOC = moc_barmonkey.cpp
OBJMOC = moc_barmonkey.obj
TARGET = barmonkey.exe
####### Implicit rules
.SUFFIXES: .cpp .cxx .cc .c
.cpp.obj:
$(CC) -c $(CFLAGS) $(INCPATH) -Fo$@ $<
.cxx.obj:
$(CC) -c $(CFLAGS) $(INCPATH) -Fo$@ $<
.cc.obj:
$(CC) -c $(CFLAGS) $(INCPATH) -Fo$@ $<
.c.obj:
$(CC) -c $(CFLAGS) $(INCPATH) -Fo$@ $<
####### Build rules
all: $(TARGET)
$(TARGET): $(OBJECTS) $(OBJMOC)
$(LINK) $(LFLAGS) /OUT:$(TARGET) @<<
$(OBJECTS) $(OBJMOC) $(LIBS)
<<
moc: $(SRCMOC)
tmake: Makefile
Makefile: barmonkey.pro
tmake barmonkey.pro -o Makefile
clean:
-del users.obj
-del inventory.obj
-del drinks.obj
-del barmonkey.obj
-del moc_barmonkey.cpp
-del moc_barmonkey.obj
-del $(TARGET)
####### Compile
barmonkey.obj: barmonkey.cpp \
inventory.h \
drinks.h \
users.h
inventory.obj: inventory.cpp \
inventory.h
drinks.obj: drinks.cpp \
drinks.h \
inventory.h
users.obj: users.cpp \
users.h \
inventory.h
As some probably notice, there is nothing at the bottom regarding moc_barmonkey because I was trying to "fix" it and ended up just deleting it, and now I don't know what to do with it. Here is the error I get:
--------------------Configuration: test - Win32 Debug--------------------
Microsoft (R) Program Maintenance Utility Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.
NMAKE : fatal error U1073: don't know how to make 'moc_barmonkey.obj'
Stop.
Error executing nmake.
test.exe - 1 error(s), 0 warning(s)
I have a feeling that my makefile might be far more complicated then it needs to be, but I know that a simple fix should be adding something about moc_barmonkey.obj towards the end. Any help is greatly appreciated.
-Kruton
Here's a makefile I modified from a sample I found on the web.
#############################################################################
# Makefile for building barmonkey
# Modified by Kruton 01/02/05
# Project: barmonkey
# Template: app
#############################################################################
####### Compiler, tools and options
CC = cl
CFLAGS = -nologo -W3 -O2 -GX
INCPATH = -I"$(QTDIR)\include"
LINK = link
LFLAGS = /NOLOGO /SUBSYSTEM:windows
LIBS = $(QTDIR)\lib\qt.lib user32.lib gdi32.lib comdlg32.lib wsock32.lib
MOC = moc
####### Files
HEADERS = inventory.h \
drinks.h \
users.h
SOURCES = inventory.cpp \
drinks.cpp \
users.cpp \
barmonkey.cpp
OBJECTS = inventory.obj \
drinks.obj \
users.obj \
barmonkey.obj
SRCMOC = moc_barmonkey.cpp
OBJMOC = moc_barmonkey.obj
TARGET = barmonkey.exe
####### Implicit rules
.SUFFIXES: .cpp .cxx .cc .c
.cpp.obj:
$(CC) -c $(CFLAGS) $(INCPATH) -Fo$@ $<
.cxx.obj:
$(CC) -c $(CFLAGS) $(INCPATH) -Fo$@ $<
.cc.obj:
$(CC) -c $(CFLAGS) $(INCPATH) -Fo$@ $<
.c.obj:
$(CC) -c $(CFLAGS) $(INCPATH) -Fo$@ $<
####### Build rules
all: $(TARGET)
$(TARGET): $(OBJECTS) $(OBJMOC)
$(LINK) $(LFLAGS) /OUT:$(TARGET) @<<
$(OBJECTS) $(OBJMOC) $(LIBS)
<<
moc: $(SRCMOC)
tmake: Makefile
Makefile: barmonkey.pro
tmake barmonkey.pro -o Makefile
clean:
-del users.obj
-del inventory.obj
-del drinks.obj
-del barmonkey.obj
-del moc_barmonkey.cpp
-del moc_barmonkey.obj
-del $(TARGET)
####### Compile
barmonkey.obj: barmonkey.cpp \
inventory.h \
drinks.h \
users.h
inventory.obj: inventory.cpp \
inventory.h
drinks.obj: drinks.cpp \
drinks.h \
inventory.h
users.obj: users.cpp \
users.h \
inventory.h
As some probably notice, there is nothing at the bottom regarding moc_barmonkey because I was trying to "fix" it and ended up just deleting it, and now I don't know what to do with it. Here is the error I get:
--------------------Configuration: test - Win32 Debug--------------------
Microsoft (R) Program Maintenance Utility Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.
NMAKE : fatal error U1073: don't know how to make 'moc_barmonkey.obj'
Stop.
Error executing nmake.
test.exe - 1 error(s), 0 warning(s)
I have a feeling that my makefile might be far more complicated then it needs to be, but I know that a simple fix should be adding something about moc_barmonkey.obj towards the end. Any help is greatly appreciated.
-Kruton