When my try to rebuild my program i m getting this errors

1>Linking...
1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
1>C:\Users\agaba\Documents\Visual Studio 2005\Projects\car\Debug\car.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://c:\Users\agaba\Documents\Visual Studio 2005\Projects\car\car\Debug\BuildLog.htm"
1>car - 2 error(s), 0 warning(s)

my code

// Short-term parking at the airport, from 4am to midnight.

#include <iostream>
 using namespace std;
 // function

 void AskTimeIn(int *pHourIn,int *pMinIn);
 void AskTimeOut(int *pHourOut,int *pMinOut);
 void write(int hoursIn,int minsIn,int hoursOut,int minsOut);

int maint()
 {
  int hoursIn, minsIn,hoursOut, minsOut;

  // difine  fuction


  AskTimeIn(&hoursIn,&minsIn); //time in function.

  AskTimeOut(&hoursOut,&minsOut);//time out function.

  write(hoursIn,minsIn,hoursOut,minsOut);// write result function.

return 0;
 }

void AskTimeIn(int *pHourIn,int *pMinIn)
{
 char colon;
    cout <<"\n Enter Time  in ,H:M format: ";
    cin >>*pHourIn>>colon>>*pMinIn;
    cin.ignore();

}
void AskTimeOut(int *pHourOut,int *pMinOut)
{
 char colon;
 cout <<"\n Enter Time out ,H:M format: ";
 cin>>*pHourOut>>colon>>*pMinOut;
 cin.ignore();

}

 void write(int hoursIn,int minsIn,int hoursOut,int minsOut)
 {

  cout<<"\n Time in :"<<hoursIn<<":"<<minsIn;
  cout<<"\n Time out :"<<hoursOut<<":"<<minsOut;
 }

Edited 3 Years Ago by Reverend Jim: Fixed formatting

When my try to rebuild my program i m getting this errors

1>Linking...
1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
1>C:\Users\agaba\Documents\Visual Studio 2005\Projects\car\Debug\car.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://c:\Users\agaba\Documents\Visual Studio 2005\Projects\car\car\Debug\BuildLog.htm"
1>car - 2 error(s), 0 warning(s)

my code

// Short-term parking at the airport, from 4am to midnight.

#include <iostream>
 using namespace std;
 // function

 void AskTimeIn(int *pHourIn,int *pMinIn);
 void AskTimeOut(int *pHourOut,int *pMinOut);
 void write(int hoursIn,int minsIn,int hoursOut,int minsOut);

int maint()
 {
  int hoursIn, minsIn,hoursOut, minsOut;

  // difine  fuction


  AskTimeIn(&hoursIn,&minsIn); //time in function.

  AskTimeOut(&hoursOut,&minsOut);//time out function.

  write(hoursIn,minsIn,hoursOut,minsOut);// write result function.

return 0;
 }

void AskTimeIn(int *pHourIn,int *pMinIn)
{
 char colon;
    cout <<"\n Enter Time  in ,H:M format: ";
    cin >>*pHourIn>>colon>>*pMinIn;
    cin.ignore();

}
void AskTimeOut(int *pHourOut,int *pMinOut)
{
 char colon;
 cout <<"\n Enter Time out ,H:M format: ";
 cin>>*pHourOut>>colon>>*pMinOut;
 cin.ignore();

}

 void write(int hoursIn,int minsIn,int hoursOut,int minsOut)
 {

  cout<<"\n Time in :"<<hoursIn<<":"<<minsIn;
  cout<<"\n Time out :"<<hoursOut<<":"<<minsOut;
 } 

end quote.

you misspelled main()....

Edited 3 Years Ago by mike_2000_17: Fixed formatting

main() function

int main()
{
   int hoursIn, minsIn,hoursOut, minsOut;
 ....
 }

Use bb code tags. Source code must be surrounded with code tags.

Edited 3 Years Ago by happygeek: fixed formatting

Thanks adatapost
i got it now

Edited 3 Years Ago by happygeek: fixed formatting

This article has been dead for over six months. Start a new discussion instead.