Jump to content

View more

View more

Image of the Day

雑魚は多めにして、爽快感重視にしつつ・・・(´・ω・`)
早いとこ、ベースを作って、完成にもっていかないとね。
タイトルもまだ迷ってるだよなぁ。 
#indiedev  #indiegame #screenshotsaturday https://t.co/IwVbswGrhe
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Gcc Error

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
1 reply to this topic

#1 rougetaal   Members   

100
Like
0Likes
Like

Posted 18 March 2012 - 07:04 AM

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

vector.h
#ifndef VECTOR_H
#define VECTOR_H
#include <math.h>
#include "matrix.h"
typedef struct vector3_s
{
float x, y, z;
}vector3;
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*);
#endif

matrix.h
#ifndef MATRIX_H
#define MATRIX_H
#include "vector.h"
typedef struct matrix4x4_s
{
float m[4][4];
}matrix4x4;
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*);
#endif

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

it gives me this error message:

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'


can you help me please.

#2 Bregma   Members   

9094
Like
0Likes
Like

Posted 18 March 2012 - 11:01 AM

You have a cicular include file dependency. The solution is to use forward declarations of your dependent classes.
Stephen M. Webb
Professional Free Software Developer




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.