- 0
[C++][MSVC] Cannot resolve this Linker error LNK2019, DirectX related
-
Recently Browsing 0 members
- No registered users viewing this page.
-
Posts
-
By George P · Posted
It's an improvement overall but I'm also of the idea that they should just give users more options and let them have the menu they like instead of just going with one outline and some minor options (though finally getting rid of recommended is great). I know people who don't want pins and would rather it all be just the list/grid of apps. Others just want pins, others want them side by side and not up on top of each other. Have more layout options and let people mix and match, problem solved. -
By Izlude · Posted
Hi all, I've got a Pioneer VSX 815-k receiver. Love this thing, however, my cat did his business on top of it and kinda recked it... Only analog works (5.1 surround RCA inputs). Normally I'd use toslink from mobo to digital in on the receiver, but the result is a ton of loud white noise over the music. Analog works just fine, so I'm forced to use the 3.5mm jacks on the rear of the mobo to the RCA inputs on the receiver. The issue I face is that there is no DTS or anything fun.. Originally, I could play all my MP3s or watch YouTube etc, and the subwoofer would be booming as I like because of the mixing from the DAC. Now with the analog, none of that is happening I'm wondering if there's some kind of software solution for Windows to get the subwoofer to play as it did when I had it hooked up through toslink, but for analog out instead. As of now, only audio files that were encoded specifically to produce sound to the sub, will work, but nothing else. As to which onboard sound solution my mobo has, this from the website's description: 121dB SNR AMP-UP Audio with ALC1220 & High-End ESS SABRE 9018 DAC with WIMA audio capacitors Sound BlasterX 720°, the top-of-the-line audio engine solution for 4K gaming and entertainment yea it uses that wonky SBx 720 app to change the audio effects n stuff.. but doesn't help with my issue Eventually yea, I wanna buy a new one. They're about $80 on ebay after shipping, but that will have to wait. -
By str8butta · Posted
Serious question here. Why is the start menu such a heated topic? I can't remember the last time that I used the start menu for anything at all other than it pops up when I hit the WIN key on my keyboard before I type for the program I want to run and then hit Enter or to restart my machine. I honestly wish it would just go away, and it just be replaced with the PowerToys Run menu. Am I missing something with the Start menu? I see people always talking about installing third party replacements and such, but I just wonder what some are actually using the Start menu for that I might be missing out on. Genuine question. Hopefully not offending anyone as I know everyone has their own way to work and access things in the OS. -
-
By Aditya Tiwari · Posted
These are the Apple Watch models that support watchOS 26 by Aditya Tiwari Apple has announced the latest operating system upgrade for its smartwatch lineup, called watchOS 26, not watchOS 12, as many expected a while ago. The Cupertino giant has unified the software experience across its platforms by introducing the "Liquid Glass" software design and renaming all the operating systems to version 26. That said, the next question is which Apple Watch models will support watchOS 26. Apple has shared the official list of devices: Apple Watch Ultra 2 Apple Watch Ultra Apple Watch Series 10 Apple Watch Series 9 Apple Watch Series 8 Apple Watch Series 7 Apple Watch Series 6 Apple Watch SE (2nd Generation) The upcoming Apple Watch update brings several new features to your wrist. Liquid Glass design gives a fresh look to the UI with updated Control Center and translucent buttons within apps. It's new Workout Buddy feature can use an Apple Intelligence-enabled iPhone nearby to provide personalized, spoken motivation during workouts. Building on the Double Tap feature, you can now flick your wrist to perform actions like muting incoming calls, silencing timers, and dismissing notifications when your hands are full. It is available on Apple Watch Ultra 2 and Apple Watch Series 9 (or later). watchOS 26 is currently available for testing through the Apple Developer Program. It will roll out to general users during the fall season, when Apple is expected to refresh the Ultra and SE models. Note that your Apple Watch must be paired with an iPhone 11 (or later) or iPhone SE (2nd generation or later) running iOS 26. While the list of Apple Watch models that support watchOS 26 remains the same, it won't work with iPhone Xs/Xs Max and iPhone Xr, which were previously supported on watchOS 11. You can check out the respective lists of supported devices for iOS 26, iPadOS 26, and macOS 26 Tahoe.
-
-
Recent Achievements
-
MusicLover2112 went up a rank
Explorer
-
MadMung0 earned a badge
Dedicated
-
CHUNWEI went up a rank
Rookie
-
the420kid went up a rank
Enthusiast
-
NeoToad777 earned a badge
Conversation Starter
-
-
Popular Contributors
-
Tell a friend
Question
The Teej
Okay guys and gals, I am absolutely 100% stumped on this one. I genuinely cannot seem to resolve this one. I've been trying for 5 days, experimenting, googling, all to no avail. I usually like to solve my own coding problems and try for as long as I can to resolve it, but this time I need some outside advice!
Basically, I'm using DirectX for my input. I have a CInput class using dinput.h to grab keyboard inputs. My compiler is MSVC++ 2010.
CInput.h
CInput.cpp
// input.cpp: implementation of the Cinput class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Input.h"
#include <windows.h>
#include <OBJBASE.H>
extern HWND g_hWnd;
extern HINSTANCE hInst;
LPDIRECTINPUT lpdi; //pointer to direct input object
LPDIRECTINPUTDEVICE lpdikey; //the keyboard device
//storage for keyboard state
UCHAR keystate[256];
UCHAR oldkeystate[256];
bool keydown[256];
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CInput::CInput()
{
if (DirectInputCreateA(hInst, DIRECTINPUT_VERSION, &lpdi, NULL)!=DI_OK)
{
// DirectInput not available; take appropriate action
}
//create keyboard device
if(lpdi->CreateDevice(GUID_SysKeyboard, &lpdikey, NULL)!=DI_OK)
{
//error
}
//set cooperation level
if(lpdikey->SetCooperativeLevel(g_hWnd, DISCL_BACKGROUND | DISCL_NONEXCLUSIVE)!=DI_OK)
{
//error
}
//set data format
if(lpdikey->SetDataFormat(&c_dfDIKeyboard)!=DI_OK)
{
//error
}
//acquire the keyboard device
if(lpdikey->Acquire()!=DI_OK)
{
//error
}
}
CInput::~CInput()
{
//unaquire keyboard
lpdikey->Unacquire();
lpdi->Release();
}
//this method refreshes the CInput class's data on which keys are currently down
//this data is stored in an array called keystate[ ]
void
CInput::GetInput()
{
//copy old keystate array
int i;
for (i=0;i<256;i++)
{
oldkeystate[i]=keystate[i];
}
if (lpdikey->GetDeviceState(256,keystate)!=DI_OK)
{
//error
}
//now check which keys are now down that weren't down last time
for (i=0;i<256;i++)
{
if ((keystate[i]>0)&&(oldkeystate[i]==0))
{
//key is now down and it wasn't before
keydown[i]=1;
}
else
{
keydown[i]=0;
}
}
}
//use this method with DirectX character constants
//which are defined in dinput.h such as DIK_SPACE
//relies on the GetInput( ) method being called first to
//update the data on which keys are currently down
//if this method doesn't seem to work then make sure you
//are calling GetInput( ) first!!!
bool
CInput::GetIfKeyDown(int whichkey)
{
if ((whichkey>256)|(whichkey<0)) return 0;
return (bool)(keystate[whichkey] & 0x80);
}
//method returns 1 or 0 depending on whether
//specified key has just been pressed
bool
CInput::GetIfKeyDownEvent(int whichkey)
{
if ((whichkey>256)|(whichkey<0)) return 0;
return (bool)(keydown[whichkey]);
}
CInput * CInput::Instance()
{
if (0==_instance)
{_instance=new CInput();
}
return _instance;
}
CInput * CInput::_instance=0;
[/CODE]
When I go to make a build, however, it compiles the code but throws up the linker error which I told you about. Here's my output from building:
1> Generating Code...
1>Input.obj : error LNK2019: unresolved external symbol _DirectInputCreateA@16 referenced in function "protected: __thiscall CInput::CInput(void)" (??0CInput@@IAE@XZ)
1>D:\Developer\ttSideScrollerWin32 - 2011 version\Debug\ttSideScrollerWin32.exe : fatal error LNK1120: 1 unresolved externals
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
[/CODE]
From what I've read, LNK2019 usually gets thrown when something isn't being included in your project or hasn't been defined. However, the CInput Constructor has definitely been defined in my header, with both CInput.h and CInput.cpp included in my project. DirectX SDK is definitely installed, my Linker Input in my Project Properties includes dxguid.lib, dinput.lib and dinput8.lib. My VC++ Directories for Input and Libraries explicitly include DirectX SDK's folders for Input and Libraries. I've gone through everything I can think of, but everything seems to be in place. I presume it's some sort of compiler issue of some kind, and one that's probably beyond my expertise. However, I'm open to any suggestions. I'm returning to programming after a fair few months of inactivity and so I'm a little rusty, which probably hasn't helped me solve this issue.
So, please Neowin, help me!!!
Link to comment
https://www.neowin.net/forum/topic/1123272-cmsvc-cannot-resolve-this-linker-error-lnk2019-directx-related/Share on other sites
2 answers to this question
Recommended Posts