Welcome to Dream.In.Code
Become a C++ Expert!

Join 137,429 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,895 people online right now. Registration is fast and FREE... Join Now!




C++ Error

 
Reply to this topicStart new topic

C++ Error

HornyAZNBoy
26 Jan, 2008 - 08:18 AM
Post #1

New D.I.C Head
*

Joined: 12 Jan, 2008
Posts: 6

I keep getting his error...

CODE
Test2.obj : error LNK2028: unresolved token (0A0002A7) "extern "C" short __stdcall GetAsyncKeyState(int)" (?GetAsyncKeyState@@$$J14YGFH@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
Test2.obj : error LNK2019: unresolved external symbol "extern "C" short __stdcall GetAsyncKeyState(int)" (?GetAsyncKeyState@@$$J14YGFH@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
C:\Documents and Settings\Computer\Desktop\C++ Projects\test2\Debug\test2.exe : fatal error LNK1120: 2 unresolved externals


I uninstalled MSVC++ and reinstalled twice, and it is still not working. There is nothing wrong with my code.

CODE
#include <iostream>
#include <windows.h>
using namespace std;

int main()
{
    while (true)
    {
        if (GetAsyncKeyState(VK_F12))
            cout << "it worked" << endl;
    }
}


Please help.
User is offlineProfile CardPM
+Quote Post

Bench
RE: C++ Error
26 Jan, 2008 - 11:59 AM
Post #2

D.I.C Addict
Group Icon

Joined: 20 Aug, 2007
Posts: 630



Thanked: 16 times
Dream Kudos: 150
Expert In: C/C++

My Contributions
It looks like you've created the wrong kind of project in MSVC++

Make sure you create a Win32 Console Project, and make sure you disable precompiled headers in your project.
User is offlineProfile CardPM
+Quote Post

born2c0de
RE: C++ Error
27 Jan, 2008 - 07:15 AM
Post #3

printf("I'm a %XR",195936478);
Group Icon

Joined: 26 Nov, 2004
Posts: 3,935



Thanked: 34 times
Dream Kudos: 2800
Expert In: 80x86 Assembly, C/C++, VB6, VB.NET, C#, J2SE, Win32 API, Reversing

My Contributions
QUOTE
I uninstalled MSVC++ and reinstalled twice, and it is still not working.

You really have a lot of patience.
User is online!Profile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/5/08 04:52AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month