Date: Sat, 21 Dec 2002 15:24:50 -0000 From: "Dave Hart" <davehart@davehart.com> To: <freebsd-stable@FreeBSD.ORG> Cc: <ranjit@rugragging.com>, <coolvibe@hackerheaven.org> Subject: RE: More information (was Re: pthread woes) Message-ID: <C1398952884B984C8AB1519CEAC66F942F2BC6@olympic.ad.hartbrothers.com>
next in thread | raw e-mail | index | archive | help
> From: ranjit@rugragging.com [mailto:ranjit@rugragging.com]=20 >=20 > Hello Emiel, >=20 > I tried and it failed, I think there's a syntax error in the=20 > first line. When I > change it to: >=20 > char XOpenDisplay() {}; >=20 > it works fine: Yes, but it's probably not what you want. You now have a program which is calling its own empty function called XOpenDisplay(). You probably want to call the XOpenDisplay from an X library instead: char XOpenDisplay(); That is a function declaration or prototype, your code above is a function _definition_, the key difference being yours has a body {} following the parameters (). > > --- test.c --- > >=20 > > char XOpenDisplay{}; > >=20 > > int main() { > > XOpenDisplay(); > > return 0; > > } > > --- end test.c --- The typo in the original code was using curly braces {} where parens were needed in char XOpenDisplay(); Or, for god's sake, the _error_ was trying to shortcut by duplicating a function declaration from some X header file when the Right Thing To Do is always to #include the appropriate .h header file containing the real declaration for XOpenDisplay(). It certainly would have saved needless hot air and wasted time on this thread. Dave To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C1398952884B984C8AB1519CEAC66F942F2BC6>