C++ Makefile Error

error: a function-definition is not allowed here before '{' to

Page 1 of 1

11 Replies - 1266 Views - Last Post: 21 February 2010 - 07:26 PM Rate Topic: -----

#1 Kaydance  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 20-September 09

C++ Makefile Error

Posted 21 February 2010 - 04:44 PM

Hi everyone...

I feel like I am really close with this, but I keep getting a string of " error: a function-definition is not allowed here before '{' token" errors... I'm a little confused with the entire makefile business all together in that if you're writing a single-file program, do you need a seperate makefile.h to store the function prototypes in, or do they go in your program? Could that be the reason why I am getting this error?





Here's the makefile.h that I have in my header:

int cashier();
int invMenu();
int bookinfo();
int reports();
int lookUpBook();
void addBook();
void editBook();
void deleteBook();
void repListing();
void repWholesale();
void repRetail();
void repQty();
void repCost();
void repAge();





Then here is what I have for the program itself...



#include <iostream>
#include <iomanip>
#include "makefile.h"
using namespace std;

int main()

{
	//Starting with the S.Booksellers main menu. 

	int choice;
	

	do 

	{
	cout << "\t\t\tSerendipity Booksellers\n";
	cout << "\t\t\t\tMain Menu\n";
	cout << "\n\n\t\t1. Cashier Module\n";
	cout << "\n\n\t\t2. Inventory Database Module\n";
	cout << "\n\n\t\t3. Report Module\n";
	cout << "\n\n\t\t4. Exit\n";
	cout << "\n\n\n\t Enter Your Choice:";
	cin >> choice;
	
// Validate the menu selection.

	while (choice < 1 || choice > 4)
	{
	cout << "Please enter a number between 1 and 4: ";
	cin >> choice;
	}


	switch(choice)
	
	{
	case 1: 
		cashier;
		break;
	case 2:
		invMenu;
		break;
	case 3:
		reports;
		break;
	case 4:
		cout <<  "\n Thank you for visiting Serendipity Books, Bye now!\n";
		break;
	default:
		cout << "\n You must enter a number between 1 and 4 to continue.\n";
	}
} while (choice !=4);

return 0;

}

		//Inserting Cashier function into mainmenu file.


int cashier()

{



	char date[11], title [30], isbn[20];
	int bookssold;
	double price, subtotal, tax, gtotal;
	char again;	
	
	do
	{



	cout << "What is the date? Please use the MM/DD/YY format. ";
	cin >> date;
	cout << "\nHow many books were purchased? ";
	cin >> bookssold;
	cout << "\nWhat is the books ISBN number? ";
	cin >> isbn;
	cout << "\nWhat is the title of the book? ";
	cin.ignore(100,'\n');
	cin.getline(title, 30);	
	cout << "\nWhat is the unit price of the book?";
	cin >> price;
	cout << "\n Do you have another book to enter? Y or N. ";
	cin >> again;
	
	} while (again == 'Y' || again == 'y');	



	subtotal = (price * bookssold);
	tax = (subtotal * 0.06);
	gtotal = (subtotal + tax);


	cout << "\t\t\t\tSerendipity Booksellers\n";
	cout << "     \n";
	cout << "     \n";
	cout << "Date: "<< date;
	cout << "     \n";
	cout << "Qty\t\tISBN\t\tTitle\t\t\tPrice\t\tTotal\n";
	cout << "______________________________________________________________\n";
	cout << " \n"; 
	cout << bookssold << "\t" << isbn << "\t" << title << "\t\t" << setprecision(2); 
	cout << fixed << price << "\t\t" << setprecision(2) << fixed << subtotal << endl;
	cout << "   \n";
	cout << "   \n";
	cout << "\t\t\t\t Subtotal: " << subtotal << "\n";
	cout << "\t\t\t\t Tax: " << tax << "\n";
	cout << "\t\t\t\t Total: " << gtotal << "\n";
	cout << "    \n";
	cout << "Thank you for shoping at Serendipity!\n";
	return 0;
}

	//Inserting Inventory menu into mainmenu file.

int invMenu()

{
	int choice;

	do
	{	

	cout << "\t\t\tSerendipity Booksellers\n";
	cout << "      \n";
	cout << "\t\t\t\tInventory Database\n";
	cout << "\n\n\t\t1. Look up a Book\n";
	cout << "\n\n\t\t2. Add a Book\n";
	cout << "\n\n\t\t3. Edit a Book's Record\n";
	cout << "\n\n\t\t4. Delete a Book\n";
	cout << "\n\n\t\t5. Return to the Main Menu\n";
	cout << "\n\n\n\t Enter Your Choice:";
	cin >> choice;

// Validate the menu selection.

	while (choice < 1 || choice > 4)
	{
	cout << "Please enter a number between 1 and 5: ";
	cin >> choice;
	}


	switch(choice)

	{
	case 1: 
		void lookUpbook();
		break;
	case 2: 
		void addBook();
		break;
	case 3:
		void editbook();
		break;
	case 4:
		void deleteBook();
		break;
	case 5: 
		cout << "Return to the Main Menu. \n";
	
	default:
		cout << "You must choose a number betwen 1 - 5.";
	}


 }while (choice !=5);	
	return 0;



		//Creating stub functions to be used later.

void lookUpBook()
	{
	cout << "You selected Look Up a Book. \n";
	}
void addBook()
	{
	cout << "You slected Add a Book. \n";
	}

void editBook()
	{
        cout << "You selected Edit Book.\n";
	}

void deleteBook()
	{
        cout << "You selected Delete Book.\n";
	}







		//Inserting Book Info into mainmenu.

int bookInfo()

{

	cout << "\t\t\tSerendipity Booksellers\n";
	cout << "      \n";
	cout << "\t\t\t\tBook Information\n";
	cout << "\n\nISBN:\n";
	cout << "\n\nTitle:\n";
	cout << "\n\nAuthor:\n";
	cout << "\n\nDate Added:\n";
	cout << "\n\nQuantity-On-Hand:\n";
	cout << "\n\nWholesale Cost:\n";
	cout << "\n\nRetail Price:\n";
	return 0;
}

		//Inserting Reports menu into mainmenu.


int reports()

{
	int choice;
	
	do
	{
	cout << "\t\t\tSerendipity Booksellers\n";
	cout << "      \n";
	cout << "\t\t\t\tReports\n";
	cout << "\n\n\t\t1. Inventory Listing\n";
	cout << "\n\n\t\t2. Inventory Wholesale Value\n";
	cout << "\n\n\t\t3. Inventory Retail Value\n";
	cout << "\n\n\t\t4. Listing by Quantity\n";
	cout << "\n\n\t\t5. Listing by Cost\n";
	cout << "\n\n\t\t6. Listing by Age:\n";
	cout << "\n\n\t\t7. Return to the Main Menu\n";
	cout << "      \n";
	cout << "\n\n\n\t Enter Your Choice:";
	cin >> choice;
	
// Validate the menu selection.

	while (choice < 1 || choice > 7)
	{
	cout << "Please enter a number between 1 and 5: ";
	cin >> choice;
	}
// Switch statements.

	switch(choice)

	{
	case 1:
		void repListing();
		break;
	case 2:
		void repWholesale();
		break;
	case 3:
		void repRetail();
		break;
	case 4:
		void repQty;
		break;
	case 5: 
		void repCost();
		break;
	case 6:
		void repAge();
		break;
	case 7:
		cout << "Returning you to the Main Menu...";
		break;
	default:
		cout << "You must enter a number between 1 and 7 to continue.\n";
	}

} while (choice !=7);
return 0;
}

}

	//creating yet another set of stub functions that will later preform opperations.
	
void repListing()
	{
	cout << "You selected Inventory Listing.";
	}
void repWholesale()
	{
	cout << "You have selected Inventory Wholesale Value.";
	}
void repRetail()
	{
	cout << "You have selected Inventory Retail Value";
	}
void repQty()
	{
	cout << "You selected Listing by Quantity.";
	}
void repCost()
	{
	cout << "You selected Listing by Cost.";
void repAge()
	{
	cout << "You selected Listing by Age.";
	} 
	
}
}




I would appreciate any ideas or constructive criticisms... I feel like I'm hitting a brick wall. :/

thanks,
Kay

Is This A Good Question/Topic? 0
  • +

Replies To: C++ Makefile Error

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6066
  • View blog
  • Posts: 23,526
  • Joined: 23-August 08

Re: C++ Makefile Error

Posted 21 February 2010 - 05:59 PM

You're attempting to define functions within the main function, which is not allowed. Move your function definitions out of main. Like this:

int main()
{
    // Code code code
    return 0;
}

int myFunc()
{
    return 1;
}

void mySecondFunc()
{

}

Was This Post Helpful? 0
  • +
  • -

#3 Kaydance  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 20-September 09

Re: C++ Makefile Error

Posted 21 February 2010 - 06:09 PM

View PostJackOfAllTrades, on 21 February 2010 - 04:59 PM, said:

You're attempting to define functions within the main function, which is not allowed. Move your function definitions out of main. Like this:

int main()
{
    // Code code code
    return 0;
}

int myFunc()
{
    return 1;
}

void mySecondFunc()
{

}




Okay, let me see if I understand then... You're saying I should leave the

 {
	//Starting with the S.Booksellers main menu. 

	int choice;
	

	do 

	{
	cout << "\t\t\tSerendipity Booksellers\n";
	cout << "\t\t\t\tMain Menu\n";
	cout << "\n\n\t\t1. Cashier Module\n";
	cout << "\n\n\t\t2. Inventory Database Module\n";
	cout << "\n\n\t\t3. Report Module\n";
	cout << "\n\n\t\t4. Exit\n";
	cout << "\n\n\n\t Enter Your Choice:";
	cin >> choice;
	
// Validate the menu selection.

	while (choice < 1 || choice > 4)
	{
	cout << "Please enter a number between 1 and 4: ";
	cin >> choice;
	}


	switch(choice)
	
	{
	case 1: 
		cashier;
		break;
	case 2:
		invMenu;
		break;
	case 3:
		reports;
		break;
	case 4:
		cout <<  "\n Thank you for visiting Serendipity Books, Bye now!\n";
		break;
	default:
		cout << "\n You must enter a number between 1 and 4 to continue.\n";
	}
} while (choice !=4);

return 0;

}



alone, and then change my next part to:
int cashier()

{



	char date[11], title [30], isbn[20];
	int bookssold;
	double price, subtotal, tax, gtotal;
	char again;	
	
	do
	{



	cout << "What is the date? Please use the MM/DD/YY format. ";
	cin >> date;
	cout << "\nHow many books were purchased? ";
	cin >> bookssold;
	cout << "\nWhat is the books ISBN number? ";
	cin >> isbn;
	cout << "\nWhat is the title of the book? ";
	cin.ignore(100,'\n');
	cin.getline(title, 30);	
	cout << "\nWhat is the unit price of the book?";
	cin >> price;
	cout << "\n Do you have another book to enter? Y or N. ";
	cin >> again;
	
	} while (again == 'Y' || again == 'y');	



	subtotal = (price * bookssold);
	tax = (subtotal * 0.06);
	gtotal = (subtotal + tax);


	cout << "\t\t\t\tSerendipity Booksellers\n";
	cout << "     \n";
	cout << "     \n";
	cout << "Date: "<< date;
	cout << "     \n";
	cout << "Qty\t\tISBN\t\tTitle\t\t\tPrice\t\tTotal\n";
	cout << "______________________________________________________________\n";
	cout << " \n"; 
	cout << bookssold << "\t" << isbn << "\t" << title << "\t\t" << setprecision(2); 
	cout << fixed << price << "\t\t" << setprecision(2) << fixed << subtotal << endl;
	cout << "   \n";
	cout << "   \n";
	cout << "\t\t\t\t Subtotal: " << subtotal << "\n";
	cout << "\t\t\t\t Tax: " << tax << "\n";
	cout << "\t\t\t\t Total: " << gtotal << "\n";
	cout << "    \n";
	cout << "Thank you for shoping at Serendipity!\n";
	return 1;
}



Then change...

void invMenu()

{
	int choice;

	do
	{	

	cout << "\t\t\tSerendipity Booksellers\n";
	cout << "      \n";
	cout << "\t\t\t\tInventory Database\n";
	cout << "\n\n\t\t1. Look up a Book\n";
	cout << "\n\n\t\t2. Add a Book\n";
	cout << "\n\n\t\t3. Edit a Book's Record\n";
	cout << "\n\n\t\t4. Delete a Book\n";
	cout << "\n\n\t\t5. Return to the Main Menu\n";
	cout << "\n\n\n\t Enter Your Choice:";
	cin >> choice;

// Validate the menu selection.

	while (choice < 1 || choice > 4)
	{
	cout << "Please enter a number between 1 and 5: ";
	cin >> choice;
	}


	switch(choice)

	{
	case 1: 
		void lookUpbook();
		break;
	case 2: 
		void addBook();
		break;
	case 3:
		void editbook();
		break;
	case 4:
		void deleteBook();
		break;
	case 5: 
		cout << "Return to the Main Menu. \n";
	
	default:
		cout << "You must choose a number betwen 1 - 5.";
	}


 }while (choice !=5);	



removing the return0; at the end?
Was This Post Helpful? 0
  • +
  • -

#4 Kaydance  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 20-September 09

Re: C++ Makefile Error

Posted 21 February 2010 - 06:17 PM

I tried making those changes... and I got the same error when trying to compile. I'm sorry, I must be too hard headed to see what I've messed up here.
Was This Post Helpful? 0
  • +
  • -

#5 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6066
  • View blog
  • Posts: 23,526
  • Joined: 23-August 08

Re: C++ Makefile Error

Posted 21 February 2010 - 06:20 PM

Oops, I'm sorry...you're not defining the functions in main, you're defining them in the invMenu() function, which is still wrong.

int invMenu()
{
        int choice;

        do
        {       

        cout << "\t\t\tSerendipity Booksellers\n";
        cout << "      \n";
        cout << "\t\t\t\tInventory Database\n";
        cout << "\n\n\t\t1. Look up a Book\n";
        cout << "\n\n\t\t2. Add a Book\n";
        cout << "\n\n\t\t3. Edit a Book's Record\n";
        cout << "\n\n\t\t4. Delete a Book\n";
        cout << "\n\n\t\t5. Return to the Main Menu\n";
        cout << "\n\n\n\t Enter Your Choice:";
        cin >> choice;

// Validate the menu selection.

        while (choice < 1 || choice > 4)
        {
        cout << "Please enter a number between 1 and 5: ";
        cin >> choice;
        }


        switch(choice)

        {
        case 1: 
                void lookUpbook();
                break;
        case 2: 
                void addBook();
                break;
        case 3:
                void editbook();
                break;
        case 4:
                void deleteBook();
                break;
        case 5: 
                cout << "Return to the Main Menu. \n";
        
        default:
                cout << "You must choose a number betwen 1 - 5.";
        }


 }while (choice !=5);   
        return 0;

                //****** You should have closed your invMenu function here!

                //Creating stub functions to be used later.

void lookUpBook()
        {
        cout << "You selected Look Up a Book. \n";
        }
void addBook()
        {
        cout << "You slected Add a Book. \n";
        }



Look in the above code for //******
Was This Post Helpful? 0
  • +
  • -

#6 Kaydance  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 20-September 09

Re: C++ Makefile Error

Posted 21 February 2010 - 06:44 PM

I really appreciate you taking the time to help me out... I closed the bracket where you've showed me. Now instead of getting several of the same " error: a function-definition is not allowed here before '{' to ", I only get one now and it's on this line:



int cashier()


{ // the error is said to be on this line.





I thought maybe there was a reason that I shouldn't have it there... so I removed it to check, and got a lot of errors. Thanks again for your help, if you have more advice I'd be so thankful...
Was This Post Helpful? 0
  • +
  • -

#7 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6066
  • View blog
  • Posts: 23,526
  • Joined: 23-August 08

Re: C++ Makefile Error

Posted 21 February 2010 - 06:47 PM

It's the same error, so it's got to be the same thing...make sure your braces all line up such that definitions of functions are never within another function. If you still can't figure it out, you'll need to post your whole code here again.
Was This Post Helpful? 0
  • +
  • -

#8 Kaydance  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 20-September 09

Re: C++ Makefile Error

Posted 21 February 2010 - 07:03 PM

I'm banging my head on the wall with this. I had a feeling the error was going to be for the same type of mistake... so I went through and mentally noted each of my braces... but unless I missed something, they all looked to be hugging the right things. I'm obviously new to programing, and quickly learning how one small thing can put you off track by hours... Or maybe I've just been looking at it too much for too long...

Either way, Jack, you're an awesome help... I know what to look for... I'm just not seeing it there... I'm posting the whole code, maybe you can... Is there nothing else at all that error could mean?


#include <iostream>
#include <iomanip>
#include "makefile.h"
using namespace std;

int main()

{
        //Starting with the S.Booksellers main menu. 

        int choice;
        

        do 

        {
        cout << "\t\t\tSerendipity Booksellers\n";
        cout << "\t\t\t\tMain Menu\n";
        cout << "\n\n\t\t1. Cashier Module\n";
        cout << "\n\n\t\t2. Inventory Database Module\n";
        cout << "\n\n\t\t3. Report Module\n";
        cout << "\n\n\t\t4. Exit\n";
        cout << "\n\n\n\t Enter Your Choice:";
        cin >> choice;
        
// Validate the menu selection.

        while (choice < 1 || choice > 4)
        {
        cout << "Please enter a number between 1 and 4: ";
        cin >> choice;
        }


        switch(choice)
        
        {
        case 1: 
                cashier;
                break;
        case 2:
                invMenu;
                break;
        case 3:
                reports;
                break;
        case 4:
                cout <<  "\n Thank you for visiting Serendipity Books, Bye now!\n";
                break;
        default:
                cout << "\n You must enter a number between 1 and 4 to continue.\n";
        }
} while (choice !=4);

return 0;



                //Inserting Cashier function into mainmenu file.


int cashier()

{



        char date[11], title [30], isbn[20];
        int bookssold;
        double price, subtotal, tax, gtotal;
        char again;     
        
        do
        {



        cout << "What is the date? Please use the MM/DD/YY format. ";
        cin >> date;
        cout << "\nHow many books were purchased? ";
        cin >> bookssold;
        cout << "\nWhat is the books ISBN number? ";
        cin >> isbn;
        cout << "\nWhat is the title of the book? ";
        cin.ignore(100,'\n');
        cin.getline(title, 30); 
        cout << "\nWhat is the unit price of the book?";
        cin >> price;
        cout << "\n Do you have another book to enter? Y or N. ";
        cin >> again;
        
        } while (again == 'Y' || again == 'y'); 



        subtotal = (price * bookssold);
        tax = (subtotal * 0.06);
        gtotal = (subtotal + tax);


        cout << "\t\t\t\tSerendipity Booksellers\n";
        cout << "     \n";
        cout << "     \n";
        cout << "Date: "<< date;
        cout << "     \n";
        cout << "Qty\t\tISBN\t\tTitle\t\t\tPrice\t\tTotal\n";
        cout << "______________________________________________________________\n";
        cout << " \n"; 
        cout << bookssold << "\t" << isbn << "\t" << title << "\t\t" << setprecision(2); 
        cout << fixed << price << "\t\t" << setprecision(2) << fixed << subtotal << endl;
        cout << "   \n";
        cout << "   \n";
        cout << "\t\t\t\t Subtotal: " << subtotal << "\n";
        cout << "\t\t\t\t Tax: " << tax << "\n";
        cout << "\t\t\t\t Total: " << gtotal << "\n";
        cout << "    \n";
        cout << "Thank you for shoping at Serendipity!\n";
        return 0;


        //Inserting Inventory menu into mainmenu file.

int invMenu()

{
        int choice;

        do
        {       

        cout << "\t\t\tSerendipity Booksellers\n";
        cout << "      \n";
        cout << "\t\t\t\tInventory Database\n";
        cout << "\n\n\t\t1. Look up a Book\n";
        cout << "\n\n\t\t2. Add a Book\n";
        cout << "\n\n\t\t3. Edit a Book's Record\n";
        cout << "\n\n\t\t4. Delete a Book\n";
        cout << "\n\n\t\t5. Return to the Main Menu\n";
        cout << "\n\n\n\t Enter Your Choice:";
        cin >> choice;

// Validate the menu selection.

        while (choice < 1 || choice > 4)
        {
        cout << "Please enter a number between 1 and 5: ";
        cin >> choice;
        }


        switch(choice)

        {
        case 1: 
                void lookUpbook();
                break;
        case 2: 
                void addBook();
                break;
        case 3:
                void editbook();
                break;
        case 4:
                void deleteBook();
                break;
        case 5: 
                cout << "Return to the Main Menu. \n";
        
        default:
                cout << "You must choose a number betwen 1 - 5.";
        }


 }while (choice !=5);   
        return 0;
}


                //Creating stub functions to be used later.

void lookUpBook()
        {
        cout << "You selected Look Up a Book. \n";
        }
void addBook()
        {
        cout << "You slected Add a Book. \n";
        }

void editBook()
        {
        cout << "You selected Edit Book.\n";
        }

void deleteBook()
        {
        cout << "You selected Delete Book.\n";
        }







                //Inserting Book Info into mainmenu.

int bookInfo()

{

        cout << "\t\t\tSerendipity Booksellers\n";
        cout << "      \n";
        cout << "\t\t\t\tBook Information\n";
        cout << "\n\nISBN:\n";
        cout << "\n\nTitle:\n";
        cout << "\n\nAuthor:\n";
        cout << "\n\nDate Added:\n";
        cout << "\n\nQuantity-On-Hand:\n";
        cout << "\n\nWholesale Cost:\n";
        cout << "\n\nRetail Price:\n";
        return 0;
}

                //Inserting Reports menu into mainmenu.


int reports()

{
        int choice;
        
        do
        {
        cout << "\t\t\tSerendipity Booksellers\n";
        cout << "      \n";
        cout << "\t\t\t\tReports\n";
        cout << "\n\n\t\t1. Inventory Listing\n";
        cout << "\n\n\t\t2. Inventory Wholesale Value\n";
        cout << "\n\n\t\t3. Inventory Retail Value\n";
        cout << "\n\n\t\t4. Listing by Quantity\n";
        cout << "\n\n\t\t5. Listing by Cost\n";
        cout << "\n\n\t\t6. Listing by Age:\n";
        cout << "\n\n\t\t7. Return to the Main Menu\n";
        cout << "      \n";
        cout << "\n\n\n\t Enter Your Choice:";
        cin >> choice;
        
// Validate the menu selection.

        while (choice < 1 || choice > 7)
        {
        cout << "Please enter a number between 1 and 5: ";
        cin >> choice;
        }
// Switch statements.

        switch(choice)

        {
        case 1:
                void repListing();
                break;
        case 2:
                void repWholesale();
                break;
        case 3:
                void repRetail();
                break;
        case 4:
                void repQty;
                break;
        case 5: 
                void repCost();
                break;
        case 6:
                void repAge();
                break;
        case 7:
                cout << "Returning you to the Main Menu...";
                break;
        default:
                cout << "You must enter a number between 1 and 7 to continue.\n";
        }

} while (choice !=7);
return 0;
}

}

        //creating yet another set of stub functions that will later preform opperations.
        
void repListing()
        {
        cout << "You selected Inventory Listing.";
        }
void repWholesale()
        {
        cout << "You have selected Inventory Wholesale Value.";
        }
void repRetail()
        {
        cout << "You have selected Inventory Retail Value";
        }
void repQty()
        {
        cout << "You selected Listing by Quantity.";
        }
void repCost()
        {
        cout << "You selected Listing by Cost.";
	}
void repAge()
        {
        cout << "You selected Listing by Age.";
        } 
        
}
}



Was This Post Helpful? 0
  • +
  • -

#9 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6066
  • View blog
  • Posts: 23,526
  • Joined: 23-August 08

Re: C++ Makefile Error

Posted 21 February 2010 - 07:10 PM

What are you using to edit your code?

Look here, at the very end of your code:
void repAge()
        {
        cout << "You selected Listing by Age.";
        } 
        
} // <=== brace closing int main()
} // <=== unmatched brace



Using a decent editor and using proper indentation will help alleviate these issues.
Was This Post Helpful? 0
  • +
  • -

#10 Kaydance  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 20-September 09

Re: C++ Makefile Error

Posted 21 February 2010 - 07:17 PM

Well, our instructor told us to write it in notepad, and then upload it to the WinSCP program and compile it puTTY... So I don't really have anything to edit my code but my own eyes... He's not been around much to answer questions... he's not very informative when he does answer them... Kind of arrogant and...well, we've gone from 20 students in class to 4 over this one project... Sounds drastic, but it's true. :/



but.. back on subject.. I moved the bracket that closed the main function down to where you said to cut it off, and really thought I did it right... Is there some editor I could get that would allow me to give the appearance that I'm doing it the way he asked? lol It sounds like that might help me a great deal...
Was This Post Helpful? 0
  • +
  • -

#11 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6066
  • View blog
  • Posts: 23,526
  • Joined: 23-August 08

Re: C++ Makefile Error

Posted 21 February 2010 - 07:20 PM

Oh, no wonder! Try Notepad++ instead! I don't use it, but it's very popular.

EDIT: Using Notepad++, load your file. Go to Language->C->C++. You should see the text change. You can then match up braces using Ctrl-B (highlight a brace and hit Ctrl-B ).

This post has been edited by JackOfAllTrades: 21 February 2010 - 07:25 PM
Reason for edit:: More directions

Was This Post Helpful? 1
  • +
  • -

#12 Kaydance  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 20-September 09

Re: C++ Makefile Error

Posted 21 February 2010 - 07:26 PM

Sweet! I'm going to download it right now. I'm excited to try it out. Thank you so much!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1