Hi,
I'm new here but i've used this forum since i've started programing in C some month ago (btw, my nick is nosila, can a moderator / admin change that please? My bad), i have a school project to finish, it is mainly about creating a database program using list's, etc... I tryed to go over the top with this learning incomplete types and how i can use them to have some pseudo OO in C (i've experience with Java so i'm work really well with this) but i'm having all sorts of trouble doing it... So, what i have now is:
(this is not my actual project, just trying to resume it with the information i found more relevant)
Code:Paint.h#include Main.h typedef struct _paint Paint;Paint.c#include Paint.h struct _paint{Car.hchar * paint_color; int paint_number;};#include Main.h typedef struct _car Car;Car.c#include Car.h struct _car{Main.hPaint * paint; char * brand; char * model;};#include <stdio.h> #include <stdlib.h> #include "Paint.h" #include "Car.h"
All of the header files have the #ifndef so the header is only defined once
Problem:
-How can i have a function in car that return the *paint???
if i have it like this
Paint * car_getPaint(Car * car);
it gives me errors in header file (in the beginning of this function signature) saying
error C2143: syntax error : missing '{' before '*'
------------
I've get this error in my project and in a "test" project i have created to test this kind of stuff... Anyone knows how to solve this??
PS: i've written this code here without testing so it may be possible i am missing some small things like ; or smtg!