-1
#include <iostream>
using namespace std;
#include "Interface.h"


void timer::start()
{
    if(! running)
    {
        begin=(unsigned int) clock();
        running=true;
    }
}

void timer::end()
{
    if(running)
    {
        finish=(unsigned int) clock();
        running=false;
    }
}

int timer::elapsed()
{
    if(running)
    {
        return((unsigned int) clock()-begin);
    }
    else
    {
        return finish-begin;
    }
}

int timer::output(unsigned int seconds)
{
    return seconds >= elapsed();
}

It says undefined reference to '_WinMain@16'

Edited by Reverend Jim: Fixed formatting

Votes + Comments
24 posts, and STILL hasn't figured out code tags :(
3
Contributors
5
Replies
7
Views
8 Years
Discussion Span
Last Post by waldchr
0

You created a windows application project and don't have a WinMain function. WinMain is the entry point for windows applications. If you're writing a program that uses main instead of WinMain, change the project type to a console application. If you really do want a windows application, there has to be a WinMain function somewhere in your .cpp files.

0

all this is is a class. you need to implement it in an actual program.

int main()
{
     timer Timer;
     //use the timer here
     return 0;
}

I'm assuming you have the actual class in "Interface.h" and that these are just the functions.

0

If the only error you get is undefined reference to winmain() then you did everything in your class right. All that error is telling you is that you don't have a main() or winmain() function for the program to start in. that will go away when you write a program that uses your class.

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.