• Create Account

## Tetris clone in an hour with C++.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

149 replies to this topic

### #141demonrealms  Members

Posted 20 April 2004 - 10:05 AM

got this: compiles fine but Bulding...that''s a difrfernt story:
------------------Configuration: tetris - Win32 Debug--------------------Linking...main.obj : error LNK2001: unresolved external symbol "public: __thiscall BitMapObject::~BitMapObject(void)" (??1BitMapObject@@QAE@XZ)main.obj : error LNK2001: unresolved external symbol "void __cdecl RotateBlock(void)" (?RotateBlock@@YAXXZ)main.obj : error LNK2001: unresolved external symbol "void __cdecl Move(int,int)" (?Move@@YAXHH@Z)main.obj : error LNK2001: unresolved external symbol "void __cdecl DrawMap(void)" (?DrawMap@@YAXXZ)main.obj : error LNK2001: unresolved external symbol "void __cdecl NewBlock(void)" (?NewBlock@@YAXXZ)Debug/tetris.exe : fatal error LNK1120: 5 unresolved externalsError executing link.exe.tetris.exe - 6 error(s), 0 warning(s)

### #142Vigo  Members

Posted 20 April 2004 - 05:01 PM

Artgeek, I would suggest if you want to understand and tinker with the code, you need to get it into your memory more. Get a book on WinAPI as a reference and a book on DX just for some fun so ya don''t have to go through all that code with no result.. WinAPI is complicated and extremely hard to remember at times, but the key is repetition and taking a break with something fun..for instance DirectX, there are lots of stuffs you can tinker with. And with DirectX alot of it uses winapi as a backbone so you get the best of both worlds. Btw, whoever said the key to learning to program is to make a tetris clone..is an idiot.. The key to learning how to program is repetition, result, and fun.. heh btw nice game Compiles great for me on dev-cpp. Duno about Linux tho, i''ll have to test that out on my debian box.
-Vigo.

### #143GloveMan  Members

Posted 28 April 2004 - 04:10 AM

Good job however,
I am running visual c++ 6.0 and I am getting these errors, any ideas?? cuz I am all out of them.

--------------------Configuration: Tetris - Win32 Debug--------------------
Compiling...
main.cpp
F:\Projects\Tetris\main.cpp(144) : error C2601: ''WinMain'' : local function definitions are illegal
F:\Projects\Tetris\main.cpp(208) : error C2601: ''GameInit'' : local function definitions are illegal
F:\Projects\Tetris\main.cpp(225) : error C2601: ''GameDone'' : local function definitions are illegal
F:\Projects\Tetris\main.cpp(230) : error C2601: ''GameLoop'' : local function definitions are illegal
F:\Projects\Tetris\main.cpp(239) : error C2601: ''NewGame'' : local function definitions are illegal
F:\Projects\Tetris\main.cpp(260) : error C2601: ''DrawTile'' : local function definitions are illegal
F:\Projects\Tetris\main.cpp(269) : error C2601: ''DrawMap'' : local function definitions are illegal
F:\Projects\Tetris\main.cpp(298) : error C2601: ''NewBlock'' : local function definitions are illegal
F:\Projects\Tetris\main.cpp(447) : error C2601: ''RotateBlock'' : local function definitions are illegal
F:\Projects\Tetris\main.cpp(479) : error C2601: ''Move'' : local function definitions are illegal
F:\Projects\Tetris\main.cpp(532) : error C2601: ''CollisionTest'' : local function definitions are illegal
F:\Projects\Tetris\main.cpp(556) : error C2601: ''RemoveRow'' : local function definitions are illegal
F:\Projects\Tetris\main.cpp(567) : fatal error C1004: unexpected end of file found
Error executing cl.exe.

main.obj - 13 error(s), 0 warning(s)

### #144GloveMan  Members

Posted 28 April 2004 - 04:24 AM

One more question, does the ''WinMain'' class replace the normal ''void main'' class when you are using windows.h? I am new to windows programming so I am just trying to figure this all out.

GloveMan

### #145MetaCipher  Members

Posted 28 April 2004 - 07:27 AM

quote:
Original post by GloveMan
One more question, does the ''WinMain'' class replace the normal ''void main'' class when you are using windows.h? I am new to windows programming so I am just trying to figure this all out.

GloveMan

Yes it does, and do keep in mind that the C++ standard now is to use ''int main''.

### #146GuerillaTactiks  Members

Posted 05 April 2011 - 09:23 PM

Maybe I just don't know enough C++ yet, but I think this was a terrible "lesson". I didn't even bother finishing because I had no idea what I was doing. I found myself copying what you had provided and trying to make sense of it myself since there was no explanation given.

Posted 05 April 2011 - 10:07 PM

You realise the last reply to this was 7 years ago, and that the original post is from 2003?

I'm sure this topic was helpful to a lot of people, but you're right that it isn't the best learning resource available. You're unlikely to get any response or updates from the original poster at this point though. If you're interested in C++ game development and have spent some time learning the basics you could consider trying Lazy Foo's SDL tutorials.

### #148Mike Peck  Members

Posted 05 April 2012 - 09:09 PM

it may be an old post, but i think its just as valuable today as it was then, i just found it myself and wish ppl where still paying attention enough to answer questions, i have one or two

### #149Mike Peck  Members

Posted 05 April 2012 - 09:25 PM

for example this one...i know im a noob but anyone know what this error is from?

Building Makefile: "C:\Dev-Cpp\projects\Makefile.win"
Executing make...
make.exe -f "C:\Dev-Cpp\projects\Makefile.win" all
g++.exe -c main.cpp -o main.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include"

g++.exe main.o bitmapobject.o -o "tetris.exe" -L"C:/Dev-Cpp/lib" -mwindows

C:/Dev-Cpp/lib/libmingw32.a(main.o)(.text+0x106):main.c: undefined reference to `WinMain@16'
collect2: ld returned 1 exit status

make.exe: *** [tetris.exe] Error 1

Execution terminated

Posted 05 April 2012 - 10:15 PM

Hehe, and that last time I replied was around a year ago today. To be honest, you'd be better off simply starting a new topic; you could link to this one if you'd like to refer other people to it. The code in question is pretty old, and likely has a number of problems including incompatibility with more modern versions of the libraries used.

I'm going to close this topic -- but as mentioned, feel free to start a new one and link to this if you would like to.

I will however firstly point out why you shouldn't use Dev-C++, and also re-iterate what I said a year ago; while there is possibly still some value in this topic, as a beginner starting now you're probably better off with a more recently updated resource such as Lazy Foo's SDL tutorials (linked above). The original post of this topic is now 10 years old, and unfortunately that means that a lot of it simply isn't relevant any more, and the choice of Dev-C++ as a development environment will be nothing but harmful to your learning experience.