LinuxQuestions.org
Visit Jeremy's Blog.
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 02-15-2006, 01:39 PM   #1
BobNutfield
Senior Member
 
Registered: Dec 2005
Location: United Kingdom
Distribution: Fedora , Ubuntu, Slackware-Current
Posts: 1,526

Rep: Reputation: 53
Compile error in practice program


Hi everybody,

Just trying another practice program and I am getting error I need to deal with. The practice programs I am using were written for a windows based compiler (Dev C++). The program line in question is

// compare the name input irrespective of case
if (stricmp(nds.firstName, "exit") == 0)

When I try to compile in with g++ it complains that "stricmp" is not declared in this scope.

I have the header #include <string.h> in the program. There must be some minor differences in the compilers for windows and Linux. Is there an equivilent g++ statement? Also, most of these practice programs end with

system("PAUSE";
return 0;

which g++ also does not recognize.

Any thoughts?

Thanks,
Bob
 
Old 02-15-2006, 01:57 PM   #2
Stack
Member
 
Registered: Oct 2003
Distribution: FreeBSD
Posts: 325

Rep: Reputation: 30
Replace "stricmp" with "strncasecmp"

Remove all system("PAUSE"); as they are not needed
 
Old 02-15-2006, 02:03 PM   #3
BobNutfield
Senior Member
 
Registered: Dec 2005
Location: United Kingdom
Distribution: Fedora , Ubuntu, Slackware-Current
Posts: 1,526

Original Poster
Rep: Reputation: 53
Thank you very much..That solved it. The system("PAUSE") is supposed to create

"Press any key to continue..."

But if it isn't needed, I won't include it.

Thanks again,

Bob
 
Old 02-15-2006, 02:33 PM   #4
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
For Dev C++ the system Pause is required if you run the program from within the IDE, otherwise it closes the console without you being able to see the final output.
 
Old 02-15-2006, 02:48 PM   #5
BobNutfield
Senior Member
 
Registered: Dec 2005
Location: United Kingdom
Distribution: Fedora , Ubuntu, Slackware-Current
Posts: 1,526

Original Poster
Rep: Reputation: 53
Thank you for that...I have been practicing the programing on both my laptop (windows using Dev C++) and on my desktop (Fedora 4 using g++) Get a little confused sometimes when they are a little different in their programming lines.


Thanks again

Bob
 
  


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
configure: error: Can't find "javac" in your PATH, when install/compile a program... JungMin Programming 5 12-07-2005 05:04 PM
configure: error: Can't find "javac" in your PATH, when install/compile a program... JungMin Linux - Software 4 12-05-2005 11:20 PM
Compile Program mattp Linux - Newbie 4 03-09-2004 11:13 AM
c program : compile/link error h/w Programming 2 10-06-2003 09:00 PM

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

All times are GMT -5. The time now is 08:55 PM.

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