473,503 Members | 3,085 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

compilation problem

#include<stdio.h>
#include<pthread.h>
int main()
{
return 0;
}

void callCancelHandlerSubscribe (void *param)
{
printf("++++callCancelHandlerSubscribe+++\n");
}

void myfunc ()
{
pthread_cleanup_push(callCancelHandlerSubscribe, 0);
return ;
}
Am I doing any thing wrong here ? i am not able to compile the above
code .

Here are error and compiler information :

SHQ >cc test.c -lpthread
"test.c", line 21: syntax error before or at: <EOF>
cc: acomp failed for test.c
SHQ >CC test.c -lpthread
"test.c", line 21: Error: "}" expected instead of EOF.
1 Error(s) detected.
SHQ >cc -V
cc: Sun WorkShop 6 update 2 C 5.3 2001/05/15
usage: cc [ options] files. Use 'cc -flags' for details
SHQ >CC -V
CC: Sun WorkShop 6 update 2 C++ 5.3 Patch 111685-19 2003/12/18

Sep 27 '06 #1
7 7559
shaanxxx said:

<snip>
void myfunc ()
{
pthread_cleanup_push(callCancelHandlerSubscribe, 0);
return ;
}
Am I doing any thing wrong here ?

Yes, two things:

Firstly, you're asking a Unix programming question in comp.lang.c instead of
in comp.unix.programmer, and secondly you're invoking a macro without
understanding it (although this is not evident purely from your source
code).

Ask this in comp.unix.programmer: "What else must I do when I invoke
pthread_cleanup_push"? (The hint, as is so often the case, is in the
name...)

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Sep 27 '06 #2
shaanxxx wrote:
#include<stdio.h>
#include<pthread.h>
int main()
{
return 0;
}

void callCancelHandlerSubscribe (void *param)
{
printf("++++callCancelHandlerSubscribe+++\n");
}

void myfunc ()
{
pthread_cleanup_push(callCancelHandlerSubscribe, 0);
return ;
}
Am I doing any thing wrong here ? i am not able to compile the above
code .

Here are error and compiler information :

SHQ >cc test.c -lpthread
"test.c", line 21: syntax error before or at: <EOF>
cc: acomp failed for test.c
SHQ >CC test.c -lpthread
"test.c", line 21: Error: "}" expected instead of EOF.
1 Error(s) detected.
SHQ >cc -V
cc: Sun WorkShop 6 update 2 C 5.3 2001/05/15
usage: cc [ options] files. Use 'cc -flags' for details
SHQ >CC -V
CC: Sun WorkShop 6 update 2 C++ 5.3 Patch 111685-19 2003/12/18
It compiles using gcc on FreeBSD, but the code above does not
have 21 lines, as indicated by the error messages, so I suspect
that you are compiling something different.

Also, since the pthread library is not part of standard C, you
might be better off asking in a platform-specific newsgroup.

--
Thomas M. Sommers -- tm*@nj.net -- AB2SB

Sep 27 '06 #3
shaanxxx wrote:
#include<stdio.h>
#include<pthread.h>
int main()
{
return 0;
}

void callCancelHandlerSubscribe (void *param)
{
printf("++++callCancelHandlerSubscribe+++\n");
}

void myfunc ()
{
pthread_cleanup_push(callCancelHandlerSubscribe, 0);
return ;
}
Am I doing any thing wrong here ? i am not able to compile the above
code .

Here are error and compiler information :

SHQ >cc test.c -lpthread
"test.c", line 21: syntax error before or at: <EOF>
cc: acomp failed for test.c
SHQ >CC test.c -lpthread
"test.c", line 21: Error: "}" expected instead of EOF.
1 Error(s) detected.
SHQ >cc -V
cc: Sun WorkShop 6 update 2 C 5.3 2001/05/15
usage: cc [ options] files. Use 'cc -flags' for details
SHQ >CC -V
CC: Sun WorkShop 6 update 2 C++ 5.3 Patch 111685-19 2003/12/18
Read the documentation for pthread_cleanup_push, it has something very
important to say about it which includes pthread_cleanup_pop.

As as side note, on many implementation these calls are not functions,
but rather macros.

Sep 27 '06 #4

Richard Heathfield wrote:
shaanxxx said:

<snip>
void myfunc ()
{
pthread_cleanup_push(callCancelHandlerSubscribe, 0);
return ;
}
Am I doing any thing wrong here ?


Yes, two things:

Firstly, you're asking a Unix programming question in comp.lang.c instead of
in comp.unix.programmer, and secondly you're invoking a macro without
understanding it (although this is not evident purely from your source
code).
I asked this question on this group because this group is 'the most
active group'.
Ask this in comp.unix.programmer: "What else must I do when I invoke
pthread_cleanup_push"? (The hint, as is so often the case, is in the
name...)

--
I have put this question on comp.unix.programmer.

Thanks

Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Sep 27 '06 #5
shaanxxx wrote:
#include<stdio.h>
#include<pthread.h>
int main()
{
return 0;
}

void callCancelHandlerSubscribe (void *param)
{
printf("++++callCancelHandlerSubscribe+++\n");
}

void myfunc ()
{
pthread_cleanup_push(callCancelHandlerSubscribe, 0);
return ;
}
Am I doing any thing wrong here ? i am not able to compile the above
code .

Here are error and compiler information :

SHQ >cc test.c -lpthread
"test.c", line 21: syntax error before or at: <EOF>
cc: acomp failed for test.c
SHQ >CC test.c -lpthread
"test.c", line 21: Error: "}" expected instead of EOF.
1 Error(s) detected.
I would suggest that the above is not your real code, since it seems not
to have anything to generate such diagnostics. Try the below, which has
been cleaned up sufficiently to be topical in <news:comp.lang.c>:

#include <stdio.h>
#if 0
/* mha: <pthread.his not a standard header, so I have commented out
the next line. */
#include <pthread.h>
#endif

/* mha: since there is no standard function pthread_cleanup_push(), I
have added this definition. */
void pthread_cleanup_push(void f(void *), int q)
{
}

int main(void)
{
return 0;
}

void callCancelHandlerSubscribe(void *param)
{
printf("++++callCancelHandlerSubscribe+++\n");
}

void myfunc()
{
pthread_cleanup_push(callCancelHandlerSubscribe, 0);
}

Sep 27 '06 #6

Nils O. Selåsdal wrote:
shaanxxx wrote:
#include<stdio.h>
#include<pthread.h>
int main()
{
return 0;
}

void callCancelHandlerSubscribe (void *param)
{
printf("++++callCancelHandlerSubscribe+++\n");
}

void myfunc ()
{
pthread_cleanup_push(callCancelHandlerSubscribe, 0);
return ;
}
Am I doing any thing wrong here ? i am not able to compile the above
code .

Here are error and compiler information :

SHQ >cc test.c -lpthread
"test.c", line 21: syntax error before or at: <EOF>
cc: acomp failed for test.c
SHQ >CC test.c -lpthread
"test.c", line 21: Error: "}" expected instead of EOF.
1 Error(s) detected.
SHQ >cc -V
cc: Sun WorkShop 6 update 2 C 5.3 2001/05/15
usage: cc [ options] files. Use 'cc -flags' for details
SHQ >CC -V
CC: Sun WorkShop 6 update 2 C++ 5.3 Patch 111685-19 2003/12/18

Read the documentation for pthread_cleanup_push, it has something very
important to say about it which includes pthread_cleanup_pop.
Got it :)

Thanks

Sep 27 '06 #7
shaanxxx said:
>
Richard Heathfield wrote:
>shaanxxx said:
<snip>
>>
Am I doing any thing wrong here ?


Yes, two things:

Firstly, you're asking a Unix programming question in comp.lang.c instead
of in comp.unix.programmer, and secondly you're invoking a macro without
understanding it (although this is not evident purely from your source
code).

I asked this question on this group because this group is 'the most
active group'.
In which case I suggest you send future questions to alt.test, which is even
more active than comp.lang.c.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Sep 27 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
416
by: Alex Vinokur | last post by:
Hi, The code below has no problem with GNU g++ 3.3, but it has a problem with GNU g++ 3.4. What is reason for that? --------- foo.cpp : BEGIN --------- template <typename T> struct Boo
6
2213
by: Joachim | last post by:
I made some project changes (which seems it doesn't help if I undo) which have created compilation error: " Server Error in '/PCSWebApp1' Application....
3
3333
by: Dan | last post by:
Hi, I have a problem using an aspx page with a Control on it. I get the following error message Compiler Error Message: CS1595: 'Test.Class2' is defined in multiple places; using definition...
10
9355
by: RedEagle | last post by:
Hi All! Do you remember me? I am that desperate who had this error for a while: --- Compilation Error Description: An error occurred during the compilation of a resource required to service...
0
1175
by: Mythran | last post by:
I'm have 2 primary errors that seem to occur. 1.) In my ASP.Net application, I have 3 libraries (BLL, DAL, and Schema) that are used for the 4th and 5th UI libraries. All of the dependant...
3
3372
by: seema | last post by:
Hi all, I am new to C programming. I have problem compiling a sample , #include <stdio.h> int getuniqueaddress1(){ return 1; } int getuniqueaddress2(){ return 2;
4
2792
by: Bob | last post by:
Hi, In VS2003 conditional compilation constants and their state could be defined at project level. I was using this to control what features where offered by various builds. i.e....
35
2983
by: mwelsh1118 | last post by:
Why doesn't C# allow incremental compilation like Java? Specifically, in Java I can compile single .java files in isolation. The resulting individual .class files can be grouped into .jar files....
6
2830
by: maxwell | last post by:
I'm trying to use the gpp utility (Gnu points to http://en.nothingisreal.com/wiki/GPP) to do conditional compilation in Python, and I'm running into a problem: the same '#' character introduces...
1
2643
by: Alex Vinokur | last post by:
Hi, I have compilation problem on SUN CC compiler with template while using option -m64 (64-bit addressing model). No problem while using option -m32 (32-bit addressing model) $ CC -V CC:...
0
7207
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7291
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7012
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7468
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
402
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.