Eclipse Error 'Program File Does Not Exist'

In summary, you are trying to run a code that converts Celsius degree units into Fahrenheit degree units, but are getting errors. You are not sure what the problem is, but think it might be related to the compiler.
  • #1
Void123
141
0
I am pretty ignorant of this language. I am working from a '...for dummies' book to teach myself and after the first few pages I have already stumbled upon a problem. I have attached a code, pretty simple one, which I'm trying to run but there are some errors and I don't know how to resolve them. I am using eclipse and when I debug I get a message which says 'program file does not exist.' If someone can help me with this I would appreciate it.
 

Attachments

  • code.txt
    909 bytes · Views: 411
Technology news on Phys.org
  • #2
What errors are you getting? If there are compiler errors (as opposed to warnings), the compiler will not generate a program file, so you can't debug.

The first thing I notice is a malformed comment ( / ) in the first line.

Something much less serious, but not incorrect, is the conversion formula, which is more complicated than it needs to be.
Fahrenheit = Celsius *(212 - 32)/100 + 32

This is exactly the same as Fahrenheit = Celsius *9/5 + 32, since (212 - 32)/100 = 180/100 = 9/5.
Code:
/
// Program to convert temperature from Celsius degree units into Fahrenheit degree
// units into Fahrenheit degree units:
// Fahrenheit = Celsius *(212 - 32)/100 + 32
//
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;

int main(int nNumberofArgs, char* pszArgs[])
{
// enter the temperature in Celsius
int celsius;
cout << "Enter the temperature in Celsius:";
cin >> celsius;
// calculate conversion factor for Celsius
// to Fahrenheit values
int factor;
factor = 212 - 32;

// use conversion factor to convert Celsius
// into Fahrenheit values
int fahrenheit;
fahrenheit = factor * celsius/100 + 32;

// output the results (followed by a NewLine)
cout << "Fahrenheit value is";
cout << fahrenheit << endl;

// wait until user is ready before terminating program
// to allow the user to see the program results
system("PAUSE");
return 0;

}
 
  • #3
fahrenheit = factor * celsius/100 + 32;

Doesn't do what you think it does.
For anything below boiling point it will return 32.
 
  • #4
mgb_phys said:
fahrenheit = factor * celsius/100 + 32;

Doesn't do what you think it does.
For anything below boiling point it will return 32.
I agree with the "doesn't do what you think it does" part, but if celsius is a multiple of 10, the formula will give the right result. If celsius is not a multiple of 10, the results will be surprising to someone who doesn't understand integer division in C and C++.

The * and / operators are at the same precedence level, and are evaluated left to right.
 
  • #5
Mark44 said:
What errors are you getting? If there are compiler errors (as opposed to warnings), the compiler will not generate a program file, so you can't debug.

The first thing I notice is a malformed comment ( / ) in the first line.

I corrected it, but its still doing the same thing.
 
  • #6
You're running it in eclipse? With what compiler? My guess with that error message is that you don't have the right plugins installed in the IDE. I've never worked with C++ in eclipse, but I think there is a development kit called CDT that you can use. Did you try a different IDE? I got this code to work in visual studio, so I don't know what the problem is.

The only thing is you have to add the standard header file
#include "stdafx.h"

Let us know if you're still getting errors and what they say. See if you can get it to compile with something besides eclipse.
 

Related to Eclipse Error 'Program File Does Not Exist'

What is an "Eclipse Error 'Program File Does Not Exist'"?

An "Eclipse Error 'Program File Does Not Exist'" is an error message that appears when trying to run a program in the Eclipse Integrated Development Environment (IDE). It indicates that the specified program file cannot be found.

Why am I getting this error?

There are several reasons why you may be getting this error, including:- The program file may have been moved or deleted.- The program file may not have been imported properly into the Eclipse project.- There may be a typo in the program file name or path.- The program file may be located in a different directory than expected.- The program file may be corrupted or damaged.

How can I fix this error?

To fix this error, you can try the following steps:- Double-check that the program file exists in the specified location.- Make sure the program file is properly imported into the Eclipse project.- Check for any typos in the program file name or path.- Verify that the program file is in the correct directory.- Try deleting and re-adding the program file to the project.- If the program file is damaged, try replacing it with a backup or re-downloading it.If none of these solutions work, you may need to seek further assistance from a programming expert.

Is this error specific to Eclipse?

Yes, this error is specific to the Eclipse IDE. Other IDEs may have similar error messages, but the solutions may differ as each IDE has its own unique features and settings.

Can I prevent this error from happening?

While it may not be possible to completely prevent this error from happening, there are some steps you can take to minimize the chances of encountering it:- Double-check file names and paths when adding new files to an Eclipse project.- Make sure to properly import all necessary files into the project.- Regularly back up your project files to prevent data loss in case of file corruption or deletion.- If possible, keep all project files in a single directory to avoid any confusion or errors.- Try to avoid making changes to file names or paths once they have been added to the project.- Keep your IDE and project files up to date to avoid any compatibility issues.

Similar threads

  • Programming and Computer Science
Replies
33
Views
2K
  • Programming and Computer Science
Replies
8
Views
1K
  • Programming and Computer Science
Replies
2
Views
683
  • Programming and Computer Science
Replies
1
Views
672
  • Programming and Computer Science
Replies
11
Views
1K
  • Programming and Computer Science
2
Replies
65
Views
3K
  • Programming and Computer Science
Replies
29
Views
2K
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
9
Views
964
  • Programming and Computer Science
Replies
14
Views
1K
Back
Top