I am using VS6, and after changing my #define (macros..) values, I got warnings, of macro redefinition. If I comment the #defines, the game works, as if I would be using my previous definitions.
First time, I defined the values, I had no warnings, no errors. It looks like the macros are stored somewhere else. I am using "win32 console application".
The Code:
#define USE_CONSOLE #include <ALLEGRO.H> #include <MATH.H> #define RESOX 800 #define RESOY 800 #define RESOZ 800 #define MiD 400 #define LENGTH 200 #define PER_0 1600
The warnings:
D:\nvm\C\3DA3b\MAiN n ONLY.cpp(6) : warning C4005: 'RESOY' : macro redefinition d:\nvm\c\3da3b\main n only.cpp(6) : see previous definition of 'RESOY' D:\nvm\C\3DA3b\MAiN n ONLY.cpp(7) : warning C4005: 'RESOZ' : macro redefinition d:\nvm\c\3da3b\main n only.cpp(7) : see previous definition of 'RESOZ' D:\nvm\C\3DA3b\MAiN n ONLY.cpp(9) : warning C4005: 'MiD' : macro redefinition d:\nvm\c\3da3b\main n only.cpp(9) : see previous definition of 'MiD' D:\nvm\C\3DA3b\MAiN n ONLY.cpp(10) : warning C4005: 'LENGTH' : macro redefinition d:\nvm\c\3da3b\main n only.cpp(10) : see previous definition of 'LENGTH'
Help please, i hate getting warnings, also slows down the progress when i get something important.
Thanks..
You have them defined somewhere elese in your code.
It can't be, there's only 1 file. Here's all the project. (a lot of other files, made auto by VS..)
Also, the code given is the top(of the file). And, pressing F4, following the message directs me there..
make a test project, and see if you get the same errors if you make the same defines. If so, they're reserved words for VS6, for some reason.
edit: never mind. The problem is that you don't use header guards, and most of your .cpp files include header.h, wich in turn includes #define.h. So the defines get included multiple times.
Linking...
test1.exe - 0 error(s), 0 warning(s)
I made a new project, empty, made a file, copied there all the source, and it's fine.
I changed values of the macros, and didn't get any warning.
See my edit above.
Oh. How do I use them though?
In the define.h file, do this:
#ifndef DEFINE_H #define DEFINE_H ... rest of header file here ... #endif
Similarly for EVREY header file that will be included by more than one file. The exact term you define doesn't really matter, but what I did above is standard (taking the header name, capitalizing it, and replacing the . with _).
#include <ALLEGRO.H> #include <MATH.H>
No, it's "allegro.h" and "math.h", in lowercase. Windows doesn't mind, but every other operating system does.
Thanks, though in my case than doesn't matter.