#1
I have a project due within the hour and my code was working fine a few hours ago, but now it is not. My code looks like this:

/*
* Name: Sam Russ
* Uniqname: samruss
* GSI: Justin Dallal
*
* this program has multiple compile errors in it.
* Find them, fix them
* It also may have run-time errors, find them, fix them
* Then extend this program to add two times together
*/
/*
* This program will calculate the number of seconds corresponding
* to input
* INPUT: time in the format of hours:minutes:seconds
* Computation: number of seconds
* ASSUMPTIONS: all input is correct
* no data checking is performed
*
*
*/

#include <iostream>
using namespace std;
int main ()
{
const int secondsPerMinute = 60;
const int minutesPerHour = 60;

int hours; // how many hours in time
int minutes; // how many minutes in time
int seconds; // how many seconds in time
int hours2;
int seconds2;
int minutes2;
char divider;
int seconds3;
int minutes3;
int seconds4;
int minutes4;

cout << "Enter the first time: ";
cin >> hours >> divider >> minutes >> divider >> seconds;

cout << "Enter the second time: ";
cin >> hours2 >> divider >> minutes2 >> divider >> seconds2;

cout << endl;

minutes3 = hours * minutesPerHour + minutes;
seconds3 = minutes3 * secondsPerMinute + seconds;

minutes4 = hours2 * minutesPerHour + minutes2;
seconds4 = minutes4 * secondsPerMinute + seconds2;

cout << "The sum of the times is: " << (seconds3 + seconds4)/3600%24 << ":" << (seconds3 + seconds4)/3600%60 << ":" << (seconds3 + seconds4)%3600%60 << endl;
cout << endl;
cout << "The difference of the times is: " << (seconds4 - seconds3)/3600%24 << ":" << (seconds4 - seconds3)/3600%60 << ":" << (seconds4 - seconds3)%3600%60 << endl;
cout << endl;
cout << "Thank you for using the Time Machine" << endl;
return 0;
}


And the output error message is this:
1>------ Build started: Project: time, Configuration: Debug Win32 ------
1>Linking...
1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
1>C:\Users\Samantha\Desktop\time\Debug\time.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://c:\Users\Samantha\Desktop\time\time\Debug\BuildLog.htm"
1>time - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Can someone please tell me how to fix this?
Originally posted by TheBaron
I'm thinking you've got a beard...

Originally posted by Thornography
Okay well I want whiter teeth... and I would like to know if rubbing sandpaper on your teeth is safe or not.
#2
did you forget the semi colon on "int main ()"?

edit: nvm, im a horrible programmer.
Jackson DXMG -> Vai Morley Wah -> Korg Black Tuner -> (Need a delay) -> Maxon OD808 -> BBE Sonic Maximizer -> ISP Noisegate -> Mesa Boogie Mark IV
#3
google
It means you're using the wrong project type. You created a Win32 application (which requires WinMain instead of main) and then treated it as if it were a console application (by using main instead of WinMain).

I just started coding in C++ last week so I'm not that great and the code looks fine to me but idk. read that ^
#4
perhaps because it can't find that library, check your spelling or your linking command. or if both of those are good, find a download of that library...
#5
I haven't fooled around with code for a couple years now, and what little I did was in C, but your error appears to be occuring in the linking stage. Check your compile environment and make sure your libraries are in place.
#7
Quote by RPGoof
google

I just started coding in C++ last week so I'm not that great and the code looks fine to me but idk. read that ^

That sounds like you're not using the right compile command (compiling as a win32 app rather than a console app).

I haven't done C++ so I can't say for sure, but from what that google quote said, that's what I'd guess.