functions messing up!

Im trying to use gotoxy which was removed from conio.h apparently.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <stdio.h>
#include <conio.h>
#include <windows.h>


void gotoxy( COORD c )
{
SetConsoleCursorPosition( GetStdHandle( STD_OUTPUT_HANDLE ), c );
}

void gotoxy( int x, int y )
{COORD c;c.X = x;c.Y = y;
gotoxy( c ); // call standard version
}




I have some other stuff in a cpp file that uses it all but all these errors come up when i run it.



1>c:\users\host\documents\visual studio 2010\projects\game1\game1\goto.h(7): error C2084: function 'void gotoxy(COORD)' already has a body

1> c:\users\host\documents\visual studio 2010\projects\game1\game1\goto.h(6) : see previous definition of 'gotoxy'

1>c:\users\host\documents\visual studio 2010\projects\game1\game1\goto.h(12): error C2084: function 'void gotoxy(int,int)' already has a body

1> c:\users\host\documents\visual studio 2010\projects\game1\game1\goto.h(11) : see previous definition of 'gotoxy'

1>c:\users\host\documents\visual studio 2010\projects\game1\game1\goto.h(13): error C2264: 'gotoxy' : error in function definition or declaration; function not called
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


I dont know exactly what it means. it says it already has a body...which im quite sure it dosnt.
From the error message it appears these errors occur in a header file. Don't put function definitions in header files unless they have internal linkage.

Also see: http://www.cplusplus.com/articles/Gw6AC542/
^^
What he said.
Topic archived. No new replies allowed.