I have started working with my first messy file. I am writing a roguelike using libtcod library, and The following is the Hello World program to test, if my environment is up and running:
#include "libtcod.hpp" int main () {TCODConsole :: initRoot (80, 50, "Partyhack"); TCODConsole :: root- & gt; Print Center (40, 25, TCOD_BKGND_NONE, "Hello World"); TCODConsole :: Flush (); TCODConsole :: waitForKeypress (true); }
My project directory structure looks like this:
/ CppPartyHack ---- / libtcod-1.5.1 # This is the libtcod root folder - ------- / Include ------------ libtcod.hpp ---- / Party Hack -------- MessieFile -------- PartyHack CPP # Code above
(As long as we are here, how can I make appropriate indentation? It is senseless to use those dashes.)
And here My makefile is:
SRCDIR =. INCDIR = ../libtcod-1.5.1/ Includes CFLAGS = $ (flag) -i $ (INCDIR) -i $ (SRCDIR) -value CC = GCC CPP = G ++ .SUFFIXES:. O H. C. Hpp CPP
$ (temp) /% O: $ (SRCDIR) /% CPP $ (CFLGS) -o $ @ -C $
CPP_OBJS = $ (TEMP) partyhack.o
All: PartyHack
PartyHack: $ (CPP_obbs) $ (CPP) $ (CPP_obbs) -o $ @ -l ./ libtcod-1.5.1 -ltcod -ltcod ++ -Wl, -rpath ,.
Clear: \ rm -f $ (CPP_OBJS) partyhock
I am using Ubuntu, and I get the following errors from my terminal Maximum: @ max desktop: ~ / desktop / development / CPPartheck / partyhack $ make
G ++ -Co partyhock.o partycack CPP
PartyCak CPP: 1: 23: Error: libtcod.hpp: There is no such file or directory - PartyHack CPP: 'int main' in function:
PartyHock. CPP: 5: Error: 'TCOD Console' has not been announced
PartyCack CPP: 6: Error: 'TCOD Console' has not been announced
PartyCack CPP: 6: Error: 'TCOD_bKGDNOn' was not announced, this scope # partyhack.cpp: 7: Error: 'TCOD Console' has not been declared
PartyCake CPP: 8: Error: 'TCOD Console' has not been declared, which is made: *** [PartyHack.O] Error 1So obviously, makefile can not find libtcod.hpp. I double checked and I am sure that the relative path of libtcod.hpp in INCDIR is true, but as I am just starting with the makefile, I am unsure what else can be wrong based on my makefile template , Which is a libtcod designer with librac only, and when I have seen some online makefile tutorials, any examples shown in the examples of code tutorials in this messayee Better than that, so I'm assuming that I've spoiled some basic in the conversion. Thanks for any help.
What happens here, is that
1) create target All
, which resolves the partyhack
.
2) Evaluates the target partyhack
, which is $ (CPP_objects)
3) target $ ( CPB_OBJS), which
$ (TMP) partyhock.o
4) targets $ (tmp) partyhack.o
Evaluates the reason that resolves partyhack.o
The reason for this is that TMP is not defined. Also keep in mind that $ (TMP)
.
5) After the slash is disappearing, evaluate the target partyhack.o
and applies the underlying rules G ++ -CO-PartyHack.O PartyHack CPP
This does not apply to the rule that you specify, i.e. $ (TEMP) /% o: $ (SRCDIR) /% CPP
because TEMP is not defined, therefore it evaluates for /partyhack.o: ./partyhack.cpp
, and we /partyhack.o
because We are not in the root directory.
6) The file is not included in the file, because the directories included in it were not passed because your rule was not applicable.
To fix this:
First of all, you need to define teem (see Nick Meyers answer).
TEMP =
Second, you have to change the definition of CPP_obbs (as suggested by Paul R).
CPP_obbs =% (tiemp) / Partihack.o
If you insert directory inside CppPartyHack / PartyHack, then it will work.
Comments
Post a Comment