Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (bdgogo), 1,447 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19056 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Organizing All Your Files In A Project [Re: Mahonroy] #394076
02/09/12 19:59
02/09/12 19:59
Joined: Sep 2003
Posts: 353
Mahonroy Offline OP
Senior Member
Mahonroy  Offline OP
Senior Member

Joined: Sep 2003
Posts: 353
Ok so I have one main.c file, multiple .c files. Each .c file has a corresponding .h file. Every .c file and .h file has a ifndef statement at the top, and an endif at the bottom (so it doesn't get defined multiple times). All of the .c files have an include of their equivalent .h file at the top (right underneith the ifndef stuff), and every .h file has an include of its corresponding .c file at the bottom (right above the endif). The .c files contain the actual functions, and the .h files contain the coresponding function prototypes, as well as some variables. The .h files also contain some #define things, that the functions use. Other .c files need to use some of these #define's though too, and this is where I am running into problems... because the other functions cannot see them.
An example... lets say I have mystuffA.c, mystuffA.h, mystuffB.c, and mystuffB.h. So mystuffA.c needs to use #defines from mystuffB.h, and mystuffB.c needs to use some #defines out of mystuffA.h
In the main.c file, at the top, I am only including all of the .h files. To get all my stuff to compile, I had to pull some of those #define statements out of the .h files, and put them in the main.c file, above all of the .h includes.

Last edited by Mahonroy; 02/09/12 20:03.

NATIO Released! Check it out at http://mahonroy.home.comcast.net/natio.htm -Matt AMD 1.2 Ghz Thunderbird 512 Meg Ram GeForce 2 Ultra 64 Meg DDR Using A5 Professional
Re: Organizing All Your Files In A Project [Re: Mahonroy] #394101
02/10/12 01:00
02/10/12 01:00
Joined: Sep 2003
Posts: 353
Mahonroy Offline OP
Senior Member
Mahonroy  Offline OP
Senior Member

Joined: Sep 2003
Posts: 353
So I'm assuming I need to make a definitions.h file, and include this at the top of my main.c then?


NATIO Released! Check it out at http://mahonroy.home.comcast.net/natio.htm -Matt AMD 1.2 Ghz Thunderbird 512 Meg Ram GeForce 2 Ultra 64 Meg DDR Using A5 Professional
Re: Organizing All Your Files In A Project [Re: Mahonroy] #394119
02/10/12 10:14
02/10/12 10:14
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline
Senior Expert
HeelX  Offline
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
No, just include "myStuffB.h" in "myStuffA.c" right under the include of "myStuffA.h"...

Code:
#ifndef myStuffA_c
#define myStuffA_c

#include "myStuffA.h"
#include "myStuffB.h"

//...

#endif /* myStuffA_c */



That is what I meant with "a .c file includes everything it needs" smile

Re: Organizing All Your Files In A Project [Re: HeelX] #394284
02/11/12 16:45
02/11/12 16:45
Joined: Sep 2003
Posts: 353
Mahonroy Offline OP
Senior Member
Mahonroy  Offline OP
Senior Member

Joined: Sep 2003
Posts: 353
Ok I got ya now. After I included only the header files that were needed everything works perfectly now, thanks!


NATIO Released! Check it out at http://mahonroy.home.comcast.net/natio.htm -Matt AMD 1.2 Ghz Thunderbird 512 Meg Ram GeForce 2 Ultra 64 Meg DDR Using A5 Professional
Page 2 of 2 1 2

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1