HELP keep getting error C2182 and few others

i have tried everything, cant figure out whats wrong .. here is the code with errors as comments:

1
2
3
4
5
6
7
8
9
10
11
12
// file name drawing.h
  #include"mac.h"

void DrawFilledRect(int x, int y, int w, int h, D3DCOLOR color);


void DrawLine(int x1, int y1, int x2, int y2, int thickness, D3DCOLOR color);


void DrawLine(Vec2 src, Vec2 dst, int thickness, D3DCOLOR color);  //error C2182: 'DrawLine': illegal use of type 'void'
//error C2365: 'DrawLine': redefinition; previous definition was 'function'
//error C2065: 'Vec2': undeclared identifier 


mac.h -

#include "includes.h"
struct Vec2
{
float x, y;
};

includes.h -
#pragma once

#include<Windows.h>
#include<iostream>

#include<d3d9.h>
#include<d3dx9.h>

#pragma comment(lib,"d3d9.lib")
#pragma comment(lib,"d3dx9.lib")

#include "drawing.h"
#include "mac.h"

According to what you've written here, drawing.h includes mac.h, mac.h includes includes.h, and includes.h includes both drawing.h and mac.h. You can't have files include each other. The C preprocessor is very rudimentary, it has no logic to resolve these kinds of conflicts.
drawing.h and mac.h needs #pragma once - like includes.h
#pragma once is non-standard, though most compilers' preprocessor do understand it. Using #ifndef/#define/#endif will work with any C/C++ preprocessor as header guards.

http://cplusplus.com/forum/general/71787/

I personally use #pragma once since there is less typing, no need to match a defined token, reducing the possibility of typo errors.
thanks helios , it worked all i had to do was remove drawing.h and mac.h from includes.h and include them separately where needed. thanks for the replies everyone
Topic archived. No new replies allowed.