Jump to content
  • Advertisement
Sign in to follow this  

Gcc Error

This topic is 2767 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

Hello, I have a problem when I try to compile two c-files vector.c et son header vector.h et matrix.c matrix.h

#ifndef VECTOR_H
#define VECTOR_H
#include <math.h>
#include "matrix.h"
typedef struct vector3_s
float x, y, z;
vector3 vec3_add(vector3*, vector3*);
vector3 vec3_sub(vector3*, vector3*);
vector3 vec3_mul(vector3*, float);
float vec3_length(vector3*);
vector3 vec3_normalize(vector3*);
float vec3_dot(vector3*, vector3*);
vector3 vec3_cross(vector3*, vector3*);
vector3 vec3_translate(vector3*, matrix4x4*);

#ifndef MATRIX_H
#define MATRIX_H
#include "vector.h"
typedef struct matrix4x4_s
float m[4][4];
matrix4x4 mat_set(float, float, float, float,
float, float, float, float,
float, float, float, float,
float, float, float, float);

matrix4x4 mat_zero();
matrix4x4 mat_identity();

matrix4x4 mat_mul(matrix4x4*, matrix4x4*);
matrix4x4 mat_translate(matrix4x4*, vector3*);
matrix4x4 mat_rotate(matrix4x4*, vector3*);
matrix4x4 mat_scale(matrix4x4*, vector3*);

I compile with gcc -std=c99 -c vector.c matrix.c

it gives me this error message:

[bquote]In file included from vector.h:6:0,
from vector.c:1:
matrix.h:21:37: erreur: unknown type name 'vector3'
matrix.h:22:34: erreur: unknown type name 'vector3'
matrix.h:23:33: erreur: unknown type name 'vector3'
In file included from matrix.h:4:0,
from matrix.c:1:
vector.h:23:34: erreur: unknown type name 'matrix4x4'[/bquote]

can you help me please.

Share this post

Link to post
Share on other sites
You have a cicular include file dependency. The solution is to use forward declarations of your dependent classes.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!