0

clang is telling me that there is something wrong with my use of GetFloat(). Does Anything pop out at you? Will you help me figure out what is wrong?

#include <cs50.h>
#include <stdio.h>

int main(void) 
{
    printf("Please provide a temperature in Fahrehnheit: ");
    float f = GetFloat();

    float c = 5.0 / 9.0 * (f - 32.0);   
    printf("%f\n", c); 
}
2
  • Your code as written compiles and runs correctly for me. Have you run update50? Are you using the current appliance? what is the actual error that you are getting? It is more likely a problem with your environment. – Cliff B Jun 3 '15 at 1:58
  • Thank you. I was using the ISO file (I installed the appliance on my computer. Maybe I was using the wrong one). I just ran it in the virtual environment and it worked. However the same compiled file that i made in the virtual environment doesn't want to work in my Ubuntu 14.04 LTS Terminal for some reason. – Chase Kolozsy Jun 3 '15 at 2:39
1

The short version is that you shouldn't expect an executable compiled for one version of Linux to work on another. The simple explanation is that because of all the variations between all the different types and releases of Linux, the only way that an executable is likely to run is if it was compiled with the same version of the same release of the operating system. Here's a good article with details to help you understand:

http://www.howtogeek.com/117579/htg-explains-how-software-installation-package-managers-work-on-linux/

This is why CS50 makes a virtual machine available to the class. By having everyone work in the same virtual environment, they can eliminate almost all of the issues that would manifest if everyone used their own preferred Linux environment.

If this (and earlier comments) answers your question, please accept this answer to mark the question as answered and remove it from the unanswered question pool. Let's keep up on forum housekeeping. ;-)

1
  • Thank you. I will mark it as answered. – Chase Kolozsy Jan 23 '16 at 5:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .