This topic is now archived and is closed to further replies.

Real Easy Annoying Question

This topic is 6363 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

ARRRGHHHHH! OK I''m using MS Visual C++ 6, These are the files in my Project- Source Files: Tetris.cpp External Dependencies: Graphics.cpp, Graphics.h The compile works fine like this-except everytime I make a change to Graphics.cpp. I have to save, exit, restart the compiler, and re-compile. If I move Graphics.cpp to Source files, and Graphics.h to Header Files I get a billion errors saying everything is allready defined in Tetris.obj. I tried deleting Tetris.obj, but that didn''t help. I tried starting a new project and cutting and pasting all the code and that didn''t help. Tetris.cpp has #include<"Graphics.cpp">, and Graphics.cpp has #include<"Graphics.h">. Somebody help-this is driving me batty and I know ist something simple! Thanks

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
hmmm, my first guess is that your forgot to define your header file.

//headef file




Also, your include should be

#include "filename" or

When you use the double quotes, the compiler first looks in the projects directory or starting in the project directory.

the tells the compiler to look in the include path specified in the compiler options.

Last thing, you should not include the .cpp file. You should include the .h in tetris.cpp. This is probably why you get those errors:

if graphics.cpp is included in tetris.cpp, that means that all the functions definitions of graphics will be included. So when tetris.cpp is compiled, all the functions in graphic.cpp are also compiled. So when comes the time to compile graphics.cpp, then the compiler will complain that it is already done!

So you need to include the header wich should contain all the functions declarations you need and let the compiler do the linking.

Share this post

Link to post
Share on other sites
Thanks-That helped out alot-The compiler is smarter than I thought. I didn''t realize that it would compile my 2nd cpp file even if it''s not included-THANK YOU!

Share this post

Link to post
Share on other sites