• 0

[c++] Can't get this base code working


Question

I'm making a temperature converter and i haven't been using c++ for around a month and i can't get this program compiling. I have spent 30 minutes trying to fix it, with little success. Can anyone help me?

main.cpp:

#include <iostream>
using namespace std;

void DrawMenu();

void DrawMenu()
{
	cout << "\t\t ***************Temperature Converter*************** \n";
	cout << "\t\t *                                                 * \n";
	cout << "\t\t *   1) Convert Celsius to Fahrenheit              * \n";
	cout << "\t\t *   2) Convert Celsius to Kalvens                 * \n";
	cout << "\t\t *   3) Convert Fahrenheit to Celsuis              * \n";
	cout << "\t\t *   4) Convert Fahrenheit to Kalvens              * \n";
    cout << "\t\t *   4) Quit                                       * \n";
	cout << "\t\t *                                                 * \n";
    cout << "\t\t *************************************************** \n";
}

void main()
{
	bool bStillPlaying = true;
	int choice = 0;

	while(bStillPlaying)
	{
  DrawMenu();

  cout << "Please enter a number from the menu: \n";
  cin >> choice;
    


	}	//while(bStillPlaying = true)

	system("PAUSE");
    return 0;

}

Edit i know the menu looks like its stuffed up on this page.

errors:

------ Build started: Project: Temperature Converter, Configuration: Debug Win32 ------

Compiling...
main.cpp
p:\Portfollio\c++\Temperature Converter(0.1)\main.cpp(42) : fatal error C1010: unexpected end of file while looking for precompiled header directive

Build log was saved at "file://p:\Portfollio\c++\Temperature Converter(0.1)\Debug\BuildLog.htm"
Temperature Converter - 1 error(s), 0 warning(s)


---------------------- Done ----------------------

    Build: 0 succeeded, 1 failed, 0 skipped

Any idea's

Thanks in advanced

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

I assume you are using Visual C++

Are you pressing Compile or actually running the program (pressing F5)? Try actually running the program.

I notice you are also using the 'system("PAUSE")' command. If you are using Visual C++ you can press CTRL F5, and it wil have a similar result.

You also seem to be returning an int in your main function when it returns a void. To fix make one of the following changes

int main()

or

return;

Link to comment
Share on other sites

  • 0

Try disabling precompiled headers in your project settings. That's what that error is.

unexpected end of file while looking for precompiled header directive

An include file specified with /Yu is not listed in the source file.

Did you inadvertently delete a #include statement that referenced the .h file that /Yu is looking for?

You may have the wrong kind of project specified for what you're trying to do. Did you create a Win32 Console Project and set the Application Settings to an Empty Project?

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.