//-------SoftLife.cpp---------
#include "Global.h"
int main(int argc, char* argv[])
{
clrscr();
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
FOREGROUND_GREEN | FOREGROUND_INTENSITY);
gotoxy(5, 5);
cout << "test";
return 0;
}
//---------------------------
//-------TextStuff.cpp-------
#include "Global.h"
void clrscr(void)
{
...
}
void gotoxy(short x, short y) //Were int
{
...
}
//---------------------------
//---------Global.h----------
#ifndef GLOBALS_H
#define GLOBALS_H
#include <windows.h>
#include <iostream.h>
#include "SoftLife.h"
#include "TextStuff.h"
#endif
//----------------------------
//--------SoftLife.h----------
#include "TextStuff.cpp"
//----------------------------
//--------TextStuff.h---------
void clrscr();
void gotoxy(short x, short y);
//----------------------------
including problems
hi, im a beginer with c++ and i believe that i am doing something wrong with how i include files. i think that its included in the wrong spot or order.
here are the 2 errors i get:
e:\myprojects\softlife\textstuff.cpp(5) : error C2084: function ''void __cdecl clrscr(void)'' already has a body
e:\myprojects\softlife\textstuff.cpp(23) : error C2084: function ''void __cdecl gotoxy(short,short)'' already has a body
here is my small sorce:
does anyone have any ideas on what i am doing wrong??
TIA
-Echo
-Echo
You''re doing a lot of things wrong
Read Kylotan''s article..
Documents [ GDNet | MSDN | STL | OpenGL | Formats | RTFM | Asking Smart Questions ]
C++ Stuff [ MinGW | Loki | SDL | Boost. | STLport | FLTK | ACCU Recommended Books ]
Read Kylotan''s article..
Documents [ GDNet | MSDN | STL | OpenGL | Formats | RTFM | Asking Smart Questions ]
C++ Stuff [ MinGW | Loki | SDL | Boost. | STLport | FLTK | ACCU Recommended Books ]
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
hmm,
well, have have now read that article 2 times. once before i posted, and i still cant see what i did wrong and how to fix it. im sure its some/many simple thing. can u tell me exactly what i did wrong and how to fix it?
-Echo
well, have have now read that article 2 times. once before i posted, and i still cant see what i did wrong and how to fix it. im sure its some/many simple thing. can u tell me exactly what i did wrong and how to fix it?
-Echo
-Echo
Wow. That is an incredibly convoluted string of inclusions. I think the problem is that you don''t understand the concept of #include, and you should definitely read up on it.
Are clrscr() and gotoxy() functions you wrote? If so, why do their bodies consist of nothing but an ellipse? If not, you definitely need to learn how to use libraries properly. In any case, you should not be including a .cpp file. And why on earth do you need three .h files that all include each other? There''s something fundamentally wrong with what you''re doing.
Are clrscr() and gotoxy() functions you wrote? If so, why do their bodies consist of nothing but an ellipse? If not, you definitely need to learn how to use libraries properly. In any case, you should not be including a .cpp file. And why on earth do you need three .h files that all include each other? There''s something fundamentally wrong with what you''re doing.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement