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


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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.