6 Replies - 2328 Views - Last Post: 12 January 2015 - 12:24 PM Rate Topic: -----

#1 prototype4   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 64
  • Joined: 22-October 12

timeGetTime function not working in Code::Blocks

Posted 12 January 2015 - 07:34 AM

ok, so i am using an online tutorial from 3DBuzz.com in code blocks cause they said their tutorial is non IDE specific. and at the moment i man having some issues. here is a sample of the code:
#include "gear_core.h"
#include <conio.h>
#include <windows.h>
#define GAME_SPEED 30

#include <iostream>
using namespace std;

bool Gear_Core::start()
{
    char key;
    startTime = timeGetTime();
    previousTime = 0;
    frameCount = 0;

    while(key != 'q')
    {
        while (!getInput(&key))
        {
            updateCore();
        }
    }
    cout << "Current Frames per Second: " << frameCount << endl;
    return(true);
}

bool Gear_Core::getInput(char *c)
{
    if (kbhit())
    {
        *c = getch();
        return(true);
    }
    else
    {
        return(false);
    }
}

void Gear_Core::updateCore(void)
{
    double currentTime = timeGetTime() - previousTime;
    if (currentTime < GAME_SPEED)
    {
        return;
    }
    else
    {
        frameCount++;
        previousTime = timeGetTime();
    }
}




and here are the errors i receive:
1.) obj\Debug\gear_core.o In function 'ZN9Gear_Core5startEv': Ln 12 undefined reference to '[email protected]'
2.) obj\Debug\gear_core.o In function 'ZN9Gear_Core10updateCoreEv': Ln 42 undefined reference to '[email protected]' Ln 50 undefined reference to '[email protected]'

what in the hell is up with code blocks?

Is This A Good Question/Topic? 0
  • +

Replies To: timeGetTime function not working in Code::Blocks

#2 jimblumberg   User is offline

  • member icon

Reputation: 5522
  • View blog
  • Posts: 17,113
  • Joined: 25-December 09

Re: timeGetTime function not working in Code::Blocks

Posted 12 January 2015 - 08:33 AM

This has nothing to do with Code::Blocks. The problem is that the linker can't find timeGetTime(). So where is this member function declared and implemented?



Jim
Was This Post Helpful? 0
  • +
  • -

#3 prototype4   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 64
  • Joined: 22-October 12

Re: timeGetTime function not working in Code::Blocks

Posted 12 January 2015 - 08:51 AM

oh shit, i for got to add the linker argument for the windows media player. lol. thanks jim.

[edit]
um, how to i add the winmm.lib library to the linker for code::blocks?
i have it linked, but now its saying it can't find winmm.lib

This post has been edited by prototype4: 12 January 2015 - 09:02 AM

Was This Post Helpful? 0
  • +
  • -

#4 jimblumberg   User is offline

  • member icon

Reputation: 5522
  • View blog
  • Posts: 17,113
  • Joined: 25-December 09

Re: timeGetTime function not working in Code::Blocks

Posted 12 January 2015 - 09:03 AM

Right click on your project in the Project Management window and select project options, linker settings, then add the correct library.


Jim
Was This Post Helpful? 0
  • +
  • -

#5 prototype4   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 64
  • Joined: 22-October 12

Re: timeGetTime function not working in Code::Blocks

Posted 12 January 2015 - 09:23 AM

i did that but its saying it cannot find the library. i guess i have to find where the library is located but i have tried to find it on my pc but i cannot find it.
Was This Post Helpful? 0
  • +
  • -

#6 jimblumberg   User is offline

  • member icon

Reputation: 5522
  • View blog
  • Posts: 17,113
  • Joined: 25-December 09

Re: timeGetTime function not working in Code::Blocks

Posted 12 January 2015 - 09:39 AM

Did you install the platform SDK? Also are you looking for the Winmm.dll instead of the .lib? Unless you're using the correct version of Microsoft compiler the .lib file probably won't work. I'm not a Windows user so I don't know exactly what SDK you need to download but you can try Googling for this problem and find out what SDK you need.

Jim
Was This Post Helpful? 0
  • +
  • -

#7 prototype4   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 64
  • Joined: 22-October 12

Re: timeGetTime function not working in Code::Blocks

Posted 12 January 2015 - 12:24 PM

ok jim thanks for the help. and no, winmm is a library. i have no idea where its located but it seems the VC++ is the only thing that can find the library.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1