The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Pro*c compilation error satvd Shell Programming and Scripting 1 05-21-2008 06:47 AM
pro*c compilation error satvd High Level Programming 0 05-21-2008 05:04 AM
compilation error mannam srinivas HP-UX 2 04-18-2008 01:52 PM
Compilation error mansoorulhaq High Level Programming 3 10-23-2007 08:01 AM
compilation error in gcc ls1429 High Level Programming 9 06-21-2006 11:02 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 05-28-2009
yschd yschd is offline
Registered User
  
 

Join Date: Apr 2009
Posts: 4
Compilation Error

I am getting the below given errors for the following program though all the variables have been declared and used appropriately. Please Help. The environment is AIX.
Error:
------
"gbsizeprofile.c", line 67.4: 1506-275 (S) Unexpected text 'void' encountered.
"gbsizeprofile.c", line 67.10: 1506-045 (S) Undeclared identifier Iid.
"gbsizeprofile.c", line 68.4: 1506-275 (S) Unexpected text 'void' encountered.
"gbsizeprofile.c", line 68.10: 1506-045 (S) Undeclared identifier Sid.
"gbsizeprofile.c", line 69.4: 1506-275 (S) Unexpected text 'void' encountered.
"gbsizeprofile.c", line 69.10: 1506-045 (S) Undeclared identifier Spid.
"gbsizeprofile.c", line 70.19: 1506-276 (S) Syntax error: possible missing ':'?
"gbsizeprofile.c", line 80.26: 1506-045 (S) Undeclared identifier attr.
"gbsizeprofile.c", line 132.44: 1506-280 (W) Function argument assignment between types "void*(*)(void*)" and "void*(*)(void*,void*,void*)" is not allowed.
[05-28-09 11:17:08] ==>dcc: Finished RC=1 make: The error code from the last command is 1.
Stop. [05-28-09 11:17:08] ==>dmake: Finished, RC=2

DESC:
------
void *InvExtract(void *t)
{
<CURRENTLY PRINTS THE THREAD ID AND EXITS>
<NEED TO EXECUTE SOME SQLS>
}
void *SalesExtract(void *t)
{
<CURRENTLY PRINTS THE THREAD ID AND EXITS>
<NEED TO EXECUTE SOME SQLS>
}

void *ShipExtract(void *t)
{
<CURRENTLY PRINTS THE THREAD ID AND EXITS>
<NEED TO EXECUTE SOME SQLS>
}
void *ExtractData(void *t,void *t1,void *t2)
{
<CREATES 3 THREADS AND JOINS THEM>
<THE 3 THREADS POINT TO THE 3 FUNCTIONS DEFINED ABOVE>
}

int main ()
{
<CREATES MAIN THREADS AND CALLS ExtractData FUNCTION>
<CURRENTLY JUST DISPLAYS SOME MESSAGE>
<AFTER SUCCESSFUL RETURN FROM THE MAIN THREAD NEED TO EXEC SOME SQLS>
}

Program:
---------

/****************************************************************************************************
*
* UK SIZE PROFILING WEEKLY BATCH JOB
*
* DATE CREATED: 19 MAY 2009
****************************************************************************************************/

#include<stdio.h>
#include<stdlib.h>
#include "pthread.h"
#define NUM_THREADS 3

/****************************************************************************************************
* FUNCTION DEFINITION
* The InvExtract extracs the inventory of all items for the current week in Apparel Departments.
* The SalesExtract extracs the sales of all items for the current week in Apparel Departments.
* The ShipExtract extracs the ship of all items for the current week in Apparel Departments.
* The job will be run parallely using threads
*
****************************************************************************************************/
void *InvExtract(void *t)
{
int i;
long tid;
tid = (long)t;
printf("Thread %ld starting... Thread Id\n",tid);
/* EXEC SQL UK_INV_EXTRACT.btq; */
printf("Thread %ld done. Inventory Extract Complete \n",tid);
pthread_exit((void*) t);
return 0;
}

void *SalesExtract(void *t)
{
int i;
long tid;
tid = (long)t;
printf("Thread %ld starting... Thread Id\n",tid);
/* EXEC SQL UK_SALES_EXTRACT.btq; */
printf("Thread %ld done. Sales Extract Complete \n",tid);
pthread_exit((void*) t);
return 0;
}

void *ShipExtract(void *t)
{
int i;
long tid;
tid = (long)t;
printf("Thread %ld starting... Thread Id\n",tid);
/* EXEC SQL UK_SHIP_EXTRACT.btq; */
printf("Thread %ld done.Shiment Extract Complete \n",tid);
pthread_exit((void*) t);
return 0;
}

void *ExtractData(void *t,void *t1,void *t2)
{
pthread_t TInv,TSales,TShip;
int i;
int rc = 0;
long tid,tid1,tid2;
double result=0.0;
tid = (long)t;
tid1 = (long)t+1;
tid2 = (long)t+2;
void *Iid;
void *Sid;
void *Spid;
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
printf("Thread %ld starting...\n",tid);
rc = pthread_create(&TInv, &attr, InvExtract, (void*)&t) ;
if(rc)
{
printf("ERROR; return code from InvExtract pthread_create() is %d\n", rc);
exit(-1);
}
pthread_attr_destroy(&attr);
rc = pthread_join(TInv, &Iid);
if (rc)
{
printf("ERROR; return code from pthread_join() is %d\n", rc);
exit(-1);
}
printf("Thread %ld starting...\n",tid1);
rc = pthread_create(&TSales, &attr, SalesExtract, (void*)&t1);
if(rc)
{
printf("ERROR; return code from SalesExtract pthread_create() is %d\n", rc);
exit(-1);
}
pthread_attr_destroy(&attr);
rc = pthread_join(TSales, &Sid);
if (rc)
{
printf("ERROR; return code from pthread_join() is %d\n", rc);
exit(-1);
}
printf("Thread %ld starting...\n",tid2);
rc = pthread_create(&TShip, &attr, ShipExtract, (void*)&t2);
if(rc)
{
printf("ERROR; return code from ShipmentExtract pthread_create() is %d\n", rc);
exit(-1);
}
pthread_attr_destroy(&attr);
rc = pthread_join(TShip, &Spid);
if (rc)
{
printf("ERROR; return code from pthread_join() is %d\n", rc);
exit(-1);
}
pthread_exit((void*) t);
return 0;
}

/****************************************************************************************************
* MAIN FUNCTION
****************************************************************************************************/
int main ()
{
pthread_t MainThread;
long t = 1;
int rc = 0;
/*void *status;*/
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
printf("\nThe process is starting execution in threads");
rc = pthread_create(&MainThread, &attr, ExtractData, (void*)&t);
if(rc)
{
printf("ERROR; return code from pthread_create() is %d\n", rc);
exit(-1);
}
pthread_attr_destroy(&attr);
rc = pthread_join(MainThread, NULL);
if (rc)
{
printf("ERROR; return code from pthread_join() is %d\n", rc);
exit(-1);
}
pthread_exit(NULL);
printf("A Sample program");
return 0;
}

Last edited by yschd; 05-28-2009 at 07:34 PM..
 

Bookmarks

Tags
c program, compile error, multithreading, pthread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:33 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0