LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-05-2006, 10:54 PM   #1
lucky6969b
Member
 
Registered: Nov 2005
Posts: 337

Rep: Reputation: 30
How to use C Scope getpid() strcmp() in C++ mode


I'd like to intermix some c/c++ code
I all have the extension of cpp
but getpid() and strcmp() were outside the scope
Could anybody help?
I used extern "C" { to no avail
the error mess
is simply
getpid not declared in this scope
etc
Thanks
Jack
 
Old 01-05-2006, 11:06 PM   #2
xhi
Senior Member
 
Registered: Mar 2005
Location: USA::Pennsylvania
Distribution: Slackware
Posts: 1,065

Rep: Reputation: 45
what files are you including..

getpid() is in unistd.h according to the man page

all you should have to to is

#include <unistd.h>

and code like normal..
 
Old 01-06-2006, 12:13 AM   #3
lucky6969b
Member
 
Registered: Nov 2005
Posts: 337

Original Poster
Rep: Reputation: 30
what about the strcmp function? the compiler was saying strcmp not declared in this scope. Thanks
Jack
 
Old 01-06-2006, 12:43 AM   #4
xhi
Senior Member
 
Registered: Mar 2005
Location: USA::Pennsylvania
Distribution: Slackware
Posts: 1,065

Rep: Reputation: 45
Quote:
Originally Posted by lucky6969b
what about the strcmp function? the compiler was saying strcmp not declared in this scope. Thanks
Jack
#include <string.h>

that should do it..

good luck
 
Old 01-06-2006, 01:50 AM   #5
lucky6969b
Member
 
Registered: Nov 2005
Posts: 337

Original Poster
Rep: Reputation: 30
thanks, I have it solved!
Thanks
Jack
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
scope of an object and global scope lucky6969b Programming 7 12-09-2005 09:09 PM
[C]How to compare two strings w/o using strcmp() kponenation Programming 22 11-23-2005 08:29 AM
strcmp() giving a large value instead of -1, 0, or 1 sovietpower Programming 4 03-09-2005 08:50 AM
c++ strings-strcmp function...... sachitha Programming 4 09-12-2004 07:28 AM
strcmp function does not seemed to work Linh Programming 4 06-12-2003 06:09 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration