0

Hi all I am receiving these errors when compiling my code, I am new to C++ programming and have trouble with the actual writing of codes. Here are the errors I am getting. I am not looking for an answer but a step in the right direction to get the correct anwswer. Thanks in advance.

error LNK2019: unresolved external symbol "double __cdecl computecartwo(double,double)" (?computecartwo@@YANNN@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "double __cdecl computecarone(double,double)" (?computecarone@@YANNN@Z) referenced in function _main
1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
1>C:\Users\will\Desktop\CIS 110\milespergallon\Debug\milespergallon.exe : fatal error LNK1120: 3 unresolved externals
1>Build log was saved at "file://c:\Users\will\Desktop\CIS 110\milespergallon\milespergallon\Debug\BuildLog.htm"

Here is the code:

// trying to compute the miles per gallon delivered by each car.

#include <iostream>
using namespace std;

const double Gallons_Per_Liter = 0.264179;

double computecarone(double litersUsed, double milesTraveled);
double computecartwo(double litersUsed, double milesTraveled);



int main()

{
    double litersUsed;
    double milesTraveled;
    double carone;
    double cartwo;

    cout << "Enter the number of liters of gasoline the first car used: ";
    cin >> litersUsed;

    cout << "Enter the number of miles the first car traveled: ";
    cin >> milesTraveled;

    cout << "Enter the number of miles gasoline the second car used: ";
    cin >> litersUsed;

    cout << "Enter the number of miles the second car traveled: ";
    cin >> milesTraveled;

    carone = computecarone(litersUsed, milesTraveled);
    cartwo = computecartwo(litersUsed, milesTraveled);


    cout.setf(ios::fixed);
    cout.setf(ios::showpoint);
    cout.precision(2);

    cout << "The number of miles per gallon the first car delivered is: " 
        << carone << endl;

    cout << "The number of miles per gallon the second car delivered is: " 
        << cartwo << endl;

    return 0;

}

Edited by Reverend Jim: Fixed formatting

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by jonsca
0

You need to change your project to a Win32 Console project rather than a plain Win 32 project. I'm not sure how to do it within the settings of the program itself, so the quickest way is to probably just make a new project (and uncheck precompiled headers while you are there).

Also, please use code tags [code] //code goes here [/code] to post your code the next time

Edited by jonsca: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.