![]() |
| | #1 |
| Rebooted Join Date: Apr 2002
Posts: 281
| Makefiles, Object files, Source files, OH MY! I am trying to make my program lake less time to compile, so i made my program modular (.o files), and made a makefile to only compile what is needed. Here is the deal (greatly simplified): main.cpp Code: #include "file2.h" #include "file3.h" #include "file4.h" Code: #include "file2.h" class stuff; Code: #include "file3.h" class morejunk; Code: #include "file4.h" class evenmorejunk; Now, the makefile has this: (simplified, again) makefile Code: junk : main.o file2.o file3.o file4.o
g++ -o junk main.o file2.o file2.o file4.o
file2.o : file2.cpp file2.h
g++ -c file2.cpp
file3.o : file3.cpp file3.h
g++ -c file3.cpp
file4.o : file4.cpp file4.h
g++ -c file4.cpp
Code: nemoserv.cpp:27: storage size of `log' isn't known nemoserv.cpp:30: storage size of `opts' isn't known nemoserv.cpp:49: storage size of `chman' isn't known nemoserv.cpp:50: storage size of `cmd' isn't known Code: nemoserv.cpp:277: aggregate `rawMsg message' has incomplete type and cannot be initialized Please tell me what I am doing wrong, or if you need more information (and what) Thanks! ~EtherealFlaim [/code]
__________________ Compilers: GCC on Red Hat 8.1 (Primary) GCC on Mac OS X 10.2.4 (Secondary) Others: MinGW on XP Last edited by Inquirer; 04-29-2003 at 09:40 PM. |
| Inquirer is offline | |
| | #2 |
| Registered User Join Date: Mar 2003
Posts: 3,844
| Those are compiler errors, not linker errors. You will need to post nemoserv.cpp (and any files it includes) if you want it fixed for you. Also, if you've made any changes, re-post the compiler errors so the line numbers will correct. gg |
| Codeplug is offline | |
| | #3 |
| Rebooted Join Date: Apr 2002
Posts: 281
| Code: g++ -ggdb -pthread -c nemoserv.cpp nemoserv.cpp:27: aggregate `logger log' has incomplete type and cannot be initialized nemoserv.cpp:30: aggregate `parsedArgs opts' has incomplete type and cannot be initialized nemoserv.cpp:49: aggregate `chanManager chman' has incomplete type and cannot be initialized nemoserv.cpp:50: aggregate `commander cmd' has incomplete type and cannot be initialized nemoserv.cpp: In function `int main (int, char **)': nemoserv.cpp:88: invalid use of undefined type `struct parsedArgs' nemoirc.h:20: forward declaration of `struct parsedArgs' nemoserv.cpp: In function `int recvParser (char *, int)': nemoserv.cpp:277: aggregate `rawMsg message' has incomplete type and cannot be initialized nemoserv.cpp: At top level: nemoserv.cpp:27: storage size of `log' isn't known nemoserv.cpp:30: storage size of `opts' isn't known nemoserv.cpp:49: storage size of `chman' isn't known nemoserv.cpp:50: storage size of `cmd' isn't known make: *** [nemoserv.o] Error 1 (NOTE: THIS FILE IS MADE WITH `tar -czvf all.zip *`, so you will need tar to unzip it. I'm not sure what graphical unzippers can untar/gunzip files. You may have to rename the file to .tgz or .tar.gz)
__________________ Compilers: GCC on Red Hat 8.1 (Primary) GCC on Mac OS X 10.2.4 (Secondary) Others: MinGW on XP |
| Inquirer is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to create a C project with multiple source files | MSF1981 | C Programming | 5 | 03-22-2009 09:25 AM |
| Multiple Source Files, make files, scope, include | thetinman | C++ Programming | 13 | 11-05-2008 11:37 PM |
| Conditional compilation for object files in Makefile? | jutirain | C++ Programming | 13 | 12-19-2007 06:23 AM |
| Threads to keep the CPU faster than the disk? | matthew180 | C Programming | 4 | 06-06-2007 03:23 PM |
| A question about constructors... | Wolve | C++ Programming | 9 | 05-04-2005 04:24 PM |