From: mert0407 AT sable DOT ox DOT ac DOT uk (George Foot) Newsgroups: comp.os.msdos.djgpp Subject: Re: DJGPP inconsistencies? Date: 13 Mar 1997 21:27:03 GMT Organization: Oxford University, England Lines: 30 Message-ID: <5g9rf7$p67@news.ox.ac.uk> References: <5g7p5i$abl AT netra DOT montana DOT edu> <01bc2fa7$9893d3c0$8c081ecb AT sly> <5g9p1b$fac AT netra DOT montana DOT edu> NNTP-Posting-Host: sable.ox.ac.uk To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Paul Peavyhouse (pv AT cs DOT montana DOT edu) wrote: : The funny thing is that if I write it as: : DATAFILE *terra; : int main (int c, char **v) : { : char *str; : terra = load_datafile("terra.dat"); : } : ...IT WORKS?!?!?! I can live with writing it this way, but I want to : know why the compiler pukes when I write it the other way. Can any help me : here? I'd appreciate it! I'll repeat this in case you had missed it amongst all the (incorrect) posts about your printf statement: In C, you *must* define all variables before any statements in a function. In C++ this is relaxed, and your original code would be correct. If you want gcc to compile your code as C++ code, make sure the file extension is .cc or .cpp, or call the compiler with a capital .C, i.e.: gcc myfile.C Hope this helps. -- George Foot Merton College, Oxford