//flex table opened by JP

Click to See Complete Forum and Search --> : Kdevelop, How to use it?


Tech^salvager
07-19-2004, 01:56 AM
Hi all, well I needs some help with Kdevelop it's my first time using it and I was trying to build project when it reported back errors. Is there something I have to do to use strings in my code? Dev-C++ was alot easier then this but I guess thats the trade off when you go to linux.
//************************************************** ************************************************** ********************************************
//FormLetter program
//This program prints a form letter for a promotinal contest.
//It uses the four parts of a name to build name strings in four
//different formats to be used in personalizing the letter
//************************************************** ************************************************** ********************************************
#include <iostream>
#include <strings>

using namespace std;

const string TITLE = "Mr.";
const string FIRST_NAME = "John";
const string MIDDLE_INITAL = "T";
const string LAST_NAME = "Barrera";

int main()
{
string first;
string fullName;
string firstLast;
string titleLast;

first = FIRST_NAME + " ";

fullName = TITLE + " " + first + MIDDLE_INITAL;
fullName = fullName + ". " + LAST_NAME;

firstLast = first + LAST_NAME;

titleLast = TITLE + " " + LAST_NAME;

cout << fullName " is a GRAND PRIZE WINNER!!!!!!" << endl << endl;
cout << " Dear " << titleLast << "," << endl << endl;
cout << "Yes it's true! " << firstLast << " has won our" << endl;
cout << "GRAND PRIZE - your choice of a 42-INCH* COLOR" << endl;
cout << "TELEVISION or a FREE WEEKEND IN NEW YORK CITY.***" << endl;
cout << "ALL that you haveto do to collect your prize is" << endl;
cout << "attend one of our fun-filled all-day presentations" << endl;
cout << "on the bebfits of owning a timeshare condominium" << endl;
cout << "trailer at the /happy Acres Mobile Campground in" << endl;
cout << "beautiful Panhard, Texas! Now " << first << "I realize" << endl;
cout << "that the three hour drive from the nearest airport" << endl;
cout << "to Panhard may seem daunting at first, but isn't" << endl;
cout << "it worth a little extra effort to recive such a" << endl;
cout << "FABULOUS PRIZE? So why wait? Give us a call right" << endl;
cout << "now to schedule your visit and collect your" << endl;
cout << "GRAND PRIZE!" << endl << endl;
cout << "Most Sincerely," << endl << endl;
cout << "Argyle M. Sneeze" << endl << endl << endl << endl;
cout << "*Measured around the circumference of the packing" << endl;
cout << "crate. ** Includes air fare and hotel accommodations." << endl;
cout << "Departure from home, Alaska; surharge applies to" << endl;
cout << "other departure airports. Accommadations within" << endl;
cout << "driving distance of New York City at the the Cheap-o-tel" << endl;
cout << "in Plattsburgh, NY." << endl;
return 0;
}

EDIT: I found about the #include <strings> mess up and change it back to #include <string> but I am still getting errors here is the output when I Build Project
*cd "/home/justin/form2/debug" && WANT_AUTOCONF_2_5="1" WANT_AUTOMAKE_1_6="1" gmake -k
*/home/justin/form2/src/form2.cpp:33: error: syntax error before string constant
*/home/justin/form2/src/form2.cpp:58:2: warning: no newline at end of file
**** Exited with status: 2 ***
Thank you for your help
Tech^:t

nothing
07-19-2004, 03:06 AM
One error I noticed just by looking at your code is that you are using comments wrong. This

// **************************************************
**************************************************
********************************************
//FormLetter program
//This program prints a form letter for a promotinal contest.
//It uses the four parts of a name to build name strings in four
//different formats to be used in personalizing the letter
// **************************************************
**************************************************
********************************************


should look like this

// **************************************************
// **************************************************
// ********************************************
//FormLetter program
//This program prints a form letter for a promotinal contest.
//It uses the four parts of a name to build name strings in four
//different formats to be used in personalizing the letter
// **************************************************
// **************************************************
// ********************************************


Another error is the

#include <strings>


it should be

#include <string>


This line

cout << fullName " is a GRAND PRIZE WINNER!!!!!!" << endl << endl;

should look like this

cout << fullName << " is a GRAND PRIZE WINNER!!!!!!" << endl << endl;


Now it should compile just fine.




:t

Tech^salvager
07-19-2004, 03:19 AM
I used comments corectly it just showed up wrong.

Well I did the changes you mentioned and now I get this*cd "/home/justin/form2/debug" && WANT_AUTOCONF_2_5="1" WANT_AUTOMAKE_1_6="1" gmake -k
*/home/justin/form2/src/form2.cpp:58:2: warning: no newline at end of file
*linking form2.C (libtool)
**** Success ***
So what does that warning mean?
BTW how do you insert code correctly into a post , do you use the # button or the PHP button?

nothing
07-19-2004, 03:47 AM
You don't need to worry about that warning. It just tells you that you forgot to put a endl or a \n at the end of the line. No big deal.

I always use the code tags when I need to insert code into a post.

Tech^salvager
07-19-2004, 03:57 AM
Ok thanks Nothing.