Hello! I'm just starting to learn c++. I also like to play chess against other people and against computer programs. There is a very famous chess program called Fruit 2.1 that I have been trying to compile the windows version before I edit the source code to change its playing style. You can find the source by googling fruit 2.1 source, its the first thing that comes up:
I'm using code::blocks IDE and have tried the watcom, borland 5.5, and the gnu gcc compilers to compile the makefile. gnu gcc gives me the least amount of errors, only one error to be exact.
the makefile build log says:
pv.cpp random.cpp recog.cpp search.cpp search_full.cpp see.cpp sort.cpp square.cpp trans.cpp util.cpp value.cpp vector.cpp > .depend
mingw32-make.exe: *** No rule to make target `Release'. Stop.
Process terminated with status 2 (0 minutes, 2 seconds)
1 errors, 0 warnings
the makefile build messages says:
Makefile|47|.depend: No such file or directory|
||=== Build finished: 1 errors, 0 warnings ===|
the makefile looks like this:
EXE = fruit
OBJS = attack.o board.o book.o eval.o fen.o hash.o list.o main.o material.o \
move.o move_check.o move_do.o move_evasion.o move_gen.o move_legal.o \
option.o pawn.o piece.o posix.o protocol.o pst.o pv.o random.o recog.o \
search.o search_full.o see.o sort.o square.o trans.o util.o value.o \
all: $(EXE) .depend
$(RM) *.o .depend gmon.out
CXX = g++
CXXFLAGS = -pipe
LDFLAGS = -lm
CXXFLAGS += -fno-exceptions -fno-rtti
CXXFLAGS += -O3 -fstrict-aliasing
CXXFLAGS += -fomit-frame-pointer
# CXXFLAGS += -march=athlon-xp # SELECT ME
LDFLAGS += -s
$(CXX) $(LDFLAGS) -o $@ $(OBJS)
$(CXX) -MM $(OBJS:.o=.cpp) > $@
could somebody explain to me in the greatest of layman's terms what i have to do to fix this....................................
c++ Need Help Compiling A Makefile
Alright, now i'm getting somewhere. I finally compiled the program without the makefile on code::blocks. The program runs fine, but I have some new questions that I hope others can answer.
A: Why is my compile so slow? I checked all the optimizations I could find in the GNU GCC compiler settings. The downloaded source comes with an executable that runs much faster. Same program but different speeds.
B: The downloaded executable displays information on the "Arena GUI" (i.e. knodes/second, total nodes evaluated) that my executable does not. Why?
C: Are all the free compilers that much slower than the commercial compilers? Is so, that is a major bummer. I'll have to buy me an expensive compiler then.
A: how long did it take? You've got 33 object files there, so presumably 33 source files; if each takes 10 seconds to compile then that's 330 seconds, i.e. 5.5 min. That's not particularly slow. That's why we have makefiles instead of batch files; a small code update will only result in the affected files being recompiled rather than the whole lot being done as would be the case if you used a batch file instead.
What hardware are you using? Maybe if you have a slow computer this will affect the time it takes.
B: no idea, probably this is a compile time option. You may need to specify a define to get that info up.
C: No, gcc is at least as good as many commercial compilers. Probably you wouldn't notice any difference if you switched to, say, Visual Studio Team Edition, at about £2500 iirc. The problem is likely due to (a) slow hardware and/or (b) unrealistically high expectations. How fast do you think this program should have built and what is that based on? How many lines of code are there in each C file and are you comparing this large application with trivial "hello world" examples that build in about a nanosecond? Compiling code is a major task for a computer and is why developers are usually equipped with the latest and greatest hardware.
Also if build times are a problem for you and there is a compiled version already available, why not just use that one?
Sorry, I guess I worded somethings incorrectly and am being misunderstood. Therefore I will repost my questions again. I finally compiled the Fruit 2.1 chess engine source without the makefile using the code::blocks IDE and the GNU GCC compiler. The executable runs fine, but I have some new questions that I hope others can answer.
A: The downloaded Fruit 2.1 chess engine source comes with an executable that runs much faster than the one I created with the GNU GCC compiler. Why is the executable I created so much slower? I have not modified the source files yet and I tried checking some of the speed optimizations in the GNU GCC compiler settings. The two programs
do exactly the same thing, but the one I created is much slower.
B: The downloaded Fruit 2.1 chess engine executable displays information on the "Arena GUI" (i.e. knodes/second, total nodes evaluated) that my executable does not. Why?
C: Do all commercial IDEs come with some special tools to get the most out of certain compilers? In other words are they able to fully optimize source code to create a better performing executable while those of us who use a free IDE like code::blocks cannot. If so, that is a major bummer because then I'll have to buy me an expensive IDE that can fully optimize and utilize certain c++ compilers.
Please remember that some of us don't the answers to these questions because we are just learning to program.
A and B will most likely need to be referred to a Fruit expert; are there any forums associated with the program? At a guess the difference will be that you used different compile-time options and that would explain the differences. The way to solve this would be to find out how the executable you downloaded was built - what exact commands were used, and of course which version of which compiler on which platform. This will all make a difference.
C in a sense, see A. It depends on what compile flags you use, and commercial compilers won't necessarily optimise better than free ones will. Don't assume that free=crap, find out why there is a slowdown first.