![]() |
| | #1 |
| Registered User Join Date: Nov 2009
Posts: 60
| Program Organisation in multiple files test.c will contain the main(), and will make use of the struct author author.h will contain the struct declaration and function declarations that work with author objects. author.c will contain the function implementations. So, the main file (test.c) will #include "author.h" My problem is that when I run this code, I won't work unless I put the struct declaration in both author.h and author.c: Code: struct author {
/*members go here*/
};
typedef struct author author;
Or is this the wrong way to organise a program? |
| hilarius is offline | |
| | #2 |
| Registered User Join Date: Jun 2008
Posts: 1,266
| Did you include author.h on author.c as well? |
| C_ntua is offline | |
| | #3 |
| Registered User Join Date: Nov 2009
Posts: 60
| No I didn't and now I feel soooo stupid! ![]() Thanks, now it works with the struct declaration in author.h! |
| hilarius is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| header files and multiple files | Dedalus | C Programming | 5 | 06-16-2009 09:21 AM |
| Allowing user selection of directory so program can run .exe files? | Tripod87 | C Programming | 4 | 07-24-2008 09:02 AM |
| WM_COPYDATA and mutex selecting multiple files | gh0st | Windows Programming | 2 | 10-27-2006 02:22 PM |
| Multiple source files for one program | gflores | C++ Programming | 3 | 08-15-2004 02:32 AM |
| Using multiple source files: Multiple Declarations & Wrong line numbers | Inquirer | C++ Programming | 1 | 05-01-2003 02:52 PM |