Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Thu, 12 May 2005 20:39:33 +1000 From: Erik de Castro Lopo To: cygwin AT cygwin DOT com Subject: Re: gcc + cygwin Message-Id: <20050512203933.1d4723cc.cygwin-erikd@mega-nerd.com> In-Reply-To: <20050512095949.87139.qmail@web50810.mail.yahoo.com> References: <20050512095949 DOT 87139 DOT qmail AT web50810 DOT mail DOT yahoo DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Marcel wrote: > I've been using a particular set of C-code for years > on several systems (mostly linux on PC, or Unix on > some Sun) and could always get it to work when I moved > to a new machine. > > Now, I'm trying to get it to work on a PC with cygwin. > > cygcheck claims I have gcc version 3.3.3-3 OK. > > I am NOT an experienced C or cygwin user, but the > problems I keep running into, appear to me that gcc > with cygwin behaves very differently from whatever I > had on the previous systems. > > gcc -g -Wall -c flm.c > flm.c:37: error: initializer element is not constant > make: *** [flm.o] Error 1 > > The offending line.37 was: > FILE *ch_par=stdout,*ch_verify=NULL; > > In my ignorance, I have to assume that gcc/cygwin is > not compatible with other gcc implementations. Can > that > be? Or could I have a botched installation of > cygwin+gcc? Probably neither. I think the C standard says that stdout might not be a compile time constant. The fix to this is th change line 37 to: FILE *ch_par = NULL, *ch_verify = NULL; Then, in the first function that uses ch_par, set it to stdout. If this file has a main() function you can just do this at the start of main: ch_par = stdout; if the file doesn't contain a main() function you should probably do this in each function that uses ch_par: if (ch_par == NULL) ch_par = stdout ; Hope this helps, Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo nospam AT mega-nerd DOT com (Yes it's valid) +-----------------------------------------------------------+ "When your hammer is C++, everything begins to look like a thumb." -- Steve Haflich, in comp.lang.c++ -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/