Menu

I gess its the include files

kangol
2007-10-18
2012-09-26
  • kangol

    kangol - 2007-10-18

    Hie!
    I am totally new in c++. Few days ago i've tried to compile this source code, with Dev C++ version 4.9.9.2. But the source is failing to compile and i dont have the slightest idea of what the problem is. Below is the source code and the errors:

    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
    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;
    }

    Executing g++.exe...
    g++.exe "C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp" -o "C:\Documents and Settings\jesualdino\My Documents\myprogram.exe" -fexceptions -g3 -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Dev-Cpp\include\c++\3.4.2" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib" -g3
    C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp: In function int main(int, char**)': C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:13: error: stray '\147' in program C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:13: error:Enter' undeclared (first use this function)
    C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:13: error: (Each undeclared identifier is reported only once for each function it appears in.)
    C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:13: error: expected `;' before "the"
    C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:13: error: stray '\148' in program

    C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:24: error: stray '\147' in program
    C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:24: error: Fahrenheit' undeclared (first use this function) C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:24: error: expected;' before "value"
    C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:24: error: stray '\148' in program

    C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:28: error: stray '\147' in program
    C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:28: error: stray '\148' in program
    C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:28: error: `PAUSE' undeclared (first use this function)

    Execution terminated

     
    • S. Thomas Bradley

      Hi Everyone:

      The problem is the quotation marks you are using: “”
      You should be using these: ""

      See the difference.

      When I use the correct quotation marks the text between " and " is highlighted in red, using yours my text stays black because the editor doesn't recognize it.

      Also, if you had read the FAQs you would have seen that it strongly recommends never having a path which contains spaces like "Documents and Settings", "My Documents", and "Program Files". Spaces cause all kinds of problems so change to somethng simply like "C:\MyStuff\myprogram"

      Hope this helps, and good luck.

      See Ya
      Butch

       

Log in to post a comment.