473,893 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ISO C++ forbids declaration of ` pthread_cond_de stroy' with no type

365 Contributor
I am using Three pthread functions below, I got ISO error, then I declared int variable called val123, then I assigned, but still I am getting error, any idea?. also I included pthread.h. compiling in Linux with GCC.


pthread_cond_si gnal(&(receiver Conf[numberofReceive rs]->receive_q_cond ));
pthread_cond_de stroy(&(receive rConf[numberofReceive rs]->receive_q_cond ));
pthread_mutex_d estroy(&(receiv erConf[numberofReceive rs]->receive_q_lock ));

Main.cpp:545: ISO C++ forbids declaration of ` pthread_cond_si gnal' with no type
Main.cpp:545: `int pthread_cond_si gnal' redeclared as different kind of symbol
/usr/include/pthread.h:398: previous declaration of `int
pthread_cond_si gnal(pthread_co nd_t*)'
Main.cpp:545: invalid conversion from `pthread_cond_t * ' to `int'

Main.cpp:546: ISO C++ forbids declaration of ` pthread_cond_de stroy' with no type
Main.cpp:546: `int pthread_cond_de stroy' redeclared as different kind of symbol
/usr/include/pthread.h:395: previous declaration of `int pthread_cond_de stroy(pthread_c ond_t*)'
Main.cpp:546: invalid conversion from `pthread_cond_t * ' to `int'

Main.cpp:547: ISO C++ forbids declaration of ` pthread_mutex_d estroy' with no type
Main.cpp:547: `int pthread_mutex_d estroy' redeclared as different kind of symbol
/usr/include/pthread.h:336: previous declaration of `int
pthread_mutex_d estroy(pthread_ mutex_t*)'
Main.cpp:547: invalid conversion from ` pthread_mutex_t *' to `int'



--------------------------------------------

int val123;



val123 = pthread_cond_si gnal((pthread_c ond_t *)&(receiverCon f[numberofReceive rs]->receive_q_cond ));
val123 = pthread_cond_de stroy(&(receive rConf[numberofReceive rs]->receive_q_cond ));
val123 = pthread_mutex_d estroy(&(receiv erConf[numberofReceive rs]->receive_q_lock ));


Main.cpp:545: ISO C++ forbids declaration of `val123' with no type
Main.cpp:545: redefinition of `int val123'
Main.cpp:546: ISO C++ forbids declaration of `val123' with no type
Main.cpp:546: redefinition of `int val123'
Main.cpp:545: `int val123' previously defined here
Main.cpp:547: ISO C++ forbids declaration of `val123' with no type
Main.cpp:547: redefinition of `int val123'
Main.cpp:546: `int val123' previously defined here
Nov 26 '09 #1
10 4357
weaknessforcats
9,208 Recognized Expert Moderator Expert
C++ does not support default-int. You have to actually specify the type or say void.
Nov 26 '09 #2
tvnaidu
365 Contributor
Do I have to redeclare pthread_cond_si gnal as void?. I wanted to use pthread lkibs, this is code is originally written in Windows, I am porting to Linux, since it is cpp file, I am compiling iwth g++ compiler.

This is already declared in pthread.h file as:
extern int pthread_cond_wa it (pthread_cond_t *__restrict __cond,
pthread_mutex_t *__restrict __mutex) __THROW;
Nov 27 '09 #3
newb16
687 Contributor
Where is this
pthread_cond_si gnal(&(receiver Conf[numberofReceive rs]->receive_q_cond ));

line located? It looks like it's outside of function and is treated as (re-)declaration of function (without return type) and compiler doesn't like it -
:545: ISO C++ forbids declaration of ` pthread_cond_si gnal' with no type
Nov 27 '09 #4
tvnaidu
365 Contributor
I am just calling this standard pthread_cond_si gnal() part of pthreads, do I have to declare this again in my Main.cpp file as extern?.
Nov 28 '09 #5
weaknessforcats
9,208 Recognized Expert Moderator Expert
You must include your pthread.h file in every .c file since each .c file is a separate compilation. The linker merges all of the object files into the executable.
Nov 28 '09 #6
tvnaidu
365 Contributor
I have Main.cpp file, in the beginning I did include pthread.cpp like below, I am trying to compile this file with g++ command like below, I need to generate .o file first, later I need to make shared lib with this, but first I am trying to compile this .cpp file, I am getting the above errors:

#include <pthread.h>


g++ -g -O2 -Wall -I. -Iinclude -fPIC -c Main.cpp
Nov 28 '09 #7
Banfa
9,065 Recognized Expert Moderator Expert
The lines of code you have posted all look fine therefore the error must be in something you didn't post. It is very hard to diagnose an error in code you can't see however your code appears to be over 500 lines long and we don't really want to see all that.

I suggest you attempt to reduce your code to the minimum compilable unit that still produces the error and then post that.
Nov 28 '09 #8
tvnaidu
365 Contributor
thank you sir, let me reduce the size and make it minimum and compile.
Nov 29 '09 #9
tvnaidu
365 Contributor
I had similar call somewhere else, that code as compiling, no problem at all, I am not getting this error for those lines, but only in this function I am getting this error, what I did was I declared just like that working code, then I compiled, it says "not declared in scope", but I declared within function, also I moved to global, no luck at all

Main.cpp:564: `cfgPtr22' was not declared in this
scope
Main.cpp:564: ISO C++ forbids declaration of `
pthread_cond_si gnal' with no type
Main.cpp:564: `int pthread_cond_si gnal' redeclared as
different kind of symbol
/usr/include/pthread.h:398: previous declaration of `int
pthread_cond_si gnal(pthread_co nd_t*)'
Main.cpp:566: ISO C++ forbids declaration of `
pthread_cond_de stroy' with no type
Nov 29 '09 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2620
by: Henrik S. Hansen | last post by:
I'm new to C++, and cannot figure out why this won't compile: std::map<std::string, int> tst; tst = 1; int main() { /*...*/ } It gives me: error: ISO C++ forbids declaration of `tst' with no type
5
2754
by: j0mbolar | last post by:
operator = (const char *string) { if(m_string) { free(m_string); m_string = 0; } if(string) { m_string = strdup(string); } }
4
35033
by: Juhan Voolaid | last post by:
Hi I need help here. When i compile my program, i get this error: $ make g++ -c -Wall inf2_functions.cpp -o inf2_functions.o inf2_classes.h:6: error: ISO C++ forbids declaration of ‘vector’ with no type inf2_classes.h:6: error: expected ‘;’ before ‘<’ token make: *** Error 1
3
50503
by: gamehack | last post by:
Hi all, Here's the error which I'm getting when trying to compile some code: boxmanager.h:16: error: ISO C++ forbids declaration of 'vector' with no type boxmanager.h:16: error: expected ';' before '<' token boxmanager.h:17: error: ISO C++ forbids declaration of 'vector' with no type
1
7382
by: eric | last post by:
hello i'm trying to implement some functionality whereby an algorithm in a base template class relies on a function pointer supplied by a derived template class. the types are only specified by the client (caller) of the derived class. i got it working under visual studio 2003/2005 but gcc 4.1.0 compilation fails. here's the smallest subset of the code that shows the error:
7
9438
by: Florian Haag | last post by:
Hello, I'm trying to compile a programme which compiles fine under Linux; I'm trying it with MinGW G++ 3.4.2: Component.h: #ifndef COMPONENT_H_ #define COMPONENT_H_
6
6032
by: mkborregaard | last post by:
Hi, I am getting an error message from MinGW that I just cannot figure what causes. The error message is: "Line 16: ISO C++ forbids declaration of 'AreaMap' with no type" My code is: #ifndef RANGE_H_INCLUDED #define RANGE_H_INCLUDED #include "grid.h" //for type: presenceGrid #include <vector>
8
7886
by: aneuryzma | last post by:
Hello, I'm merging an OpenCV app with an Ogre3d app. I'm on a mac, I'm using xCode. When I add #include "openCVApp.h" I got the following error:
6
14731
by: samsneelam | last post by:
Hi.. This is samuel, while doing a program, i encountered this problem.. Let me give you clarity regarding my prob.. I am having two files .. one is mpcplib.h it contains the follwing declerations.... #include <queue> #include <vector> #include <string> class database { queue<delayTP> delayThrouput;
0
9832
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10929
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10469
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9647
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8025
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7175
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5859
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6066
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4281
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.