W
William E. Storey II
Hello All,
I am new to C programming or Procedural programming for that matter. I
got my start in the programming world with .NET. I have decided to move
to a real programming language that is not so bloated.
My problem is that I am trying to break up my program in to seperate
files for maintainability purposes. However I cant seem to get it to
work. The project is a simple console blackjack game. I have the
following files,
- main.c
- player.c
- dealer.c
- deck.c
- play.c
I did not see the need for a library since I did not really plan on
reusing the code ( except for maybee the shuffle function ). So what I
was trying to do was just to break the modules up in to seperate files
that I could just use the includes pre processor directive in order to
combine them.
Here is where my problem is though. In the Player, Dealer, and Play
modules. I need to use the deck types however since the compiler needs
things to be in a top to bottom order I was not able to include the
files in a way that would appease the compiler. So I tried to switch to
the library Idea.
So I made deck.o, player.o, play.o and dealer.o. Howerver when I mse
the player.o, play.o and dealer.o I tried to incldue the deck.h header
file so that they could be used in the library. But I got a conflicting
types error. So I removed the deck header file and then I just got a
variable not declared error
I am at a loss and was wondering if you guys and any advice on how to
solve this problem. I am not sure if I need to restructure the project
or not. It just seems to me unneccesary to use librarys, but since i
can not do that in a way that will compile right I dont see any other
method. I would love to hear your input and ideas on this topic.
Also when designing, a library what goes in the header file and what
goes in the c file? For instance if I made a library called deck.
would I declare the deck structure in the header, c file, or both?
If you need anymore information in order to help me or would like to see
the source code that I have please feel free to email me at
(e-mail address removed).
Thanks Again for any Help Offered.
William E. Storey II
I am new to C programming or Procedural programming for that matter. I
got my start in the programming world with .NET. I have decided to move
to a real programming language that is not so bloated.
My problem is that I am trying to break up my program in to seperate
files for maintainability purposes. However I cant seem to get it to
work. The project is a simple console blackjack game. I have the
following files,
- main.c
- player.c
- dealer.c
- deck.c
- play.c
I did not see the need for a library since I did not really plan on
reusing the code ( except for maybee the shuffle function ). So what I
was trying to do was just to break the modules up in to seperate files
that I could just use the includes pre processor directive in order to
combine them.
Here is where my problem is though. In the Player, Dealer, and Play
modules. I need to use the deck types however since the compiler needs
things to be in a top to bottom order I was not able to include the
files in a way that would appease the compiler. So I tried to switch to
the library Idea.
So I made deck.o, player.o, play.o and dealer.o. Howerver when I mse
the player.o, play.o and dealer.o I tried to incldue the deck.h header
file so that they could be used in the library. But I got a conflicting
types error. So I removed the deck header file and then I just got a
variable not declared error
I am at a loss and was wondering if you guys and any advice on how to
solve this problem. I am not sure if I need to restructure the project
or not. It just seems to me unneccesary to use librarys, but since i
can not do that in a way that will compile right I dont see any other
method. I would love to hear your input and ideas on this topic.
Also when designing, a library what goes in the header file and what
goes in the c file? For instance if I made a library called deck.
would I declare the deck structure in the header, c file, or both?
If you need anymore information in order to help me or would like to see
the source code that I have please feel free to email me at
(e-mail address removed).
Thanks Again for any Help Offered.
William E. Storey II