0

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 by Reverend Jim: Fixed formatting

4
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by John A
0

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 by mike_2000_17: Fixed formatting

0

main() function

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

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

Edited by happygeek: fixed formatting

0

Thanks adatapost
i got it now

Edited by happygeek: fixed formatting

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.