linker error after compiling - c++

Im having a problem with the linker i guess
This is what i get on the output tab:
1>main-light.obj : error LNK2019: unresolved external symbol _SDL_FreeSurface referenced in function "private: unsigned int __thiscall objloader::loadTexture(char const *)" (?loadTexture#objloader##AAEIPBD#Z)
1>main-light.obj : error LNK2019: unresolved external symbol _SDL_LoadBMP_RW referenced in function "private: unsigned int __thiscall objloader::loadTexture(char const *)" (?loadTexture#objloader##AAEIPBD#Z)
1>main-light.obj : error LNK2019: unresolved external symbol _SDL_RWFromFile referenced in function "private: unsigned int __thiscall objloader::loadTexture(char const *)" (?loadTexture#objloader##AAEIPBD#Z)
1>main-light.obj : error LNK2019: unresolved external symbol _SDL_GetTicks referenced in function "public: void __thiscall Player::init(void)" (?init#Player##QAEXXZ)
1>main-light.obj : error LNK2019: unresolved external symbol _SDL_GetKeyState referenced in function "void __cdecl Control(float,float,bool)" (?Control##YAXMM_N#Z)
1>main-light.obj : error LNK2019: unresolved external symbol _SDL_WarpMouse referenced in function "void __cdecl Control(float,float,bool)" (?Control##YAXMM_N#Z)
1>main-light.obj : error LNK2019: unresolved external symbol _SDL_GetMouseState referenced in function "void __cdecl Control(float,float,bool)" (?Control##YAXMM_N#Z)
1>main-light.obj : error LNK2019: unresolved external symbol _SDL_ShowCursor referenced in function "void __cdecl Control(float,float,bool)" (?Control##YAXMM_N#Z)
1>main-light.obj : error LNK2019: unresolved external symbol _SDL_Delay referenced in function _SDL_main
1>main-light.obj : error LNK2019: unresolved external symbol _SDL_GL_SwapBuffers referenced in function _SDL_main
1>main-light.obj : error LNK2019: unresolved external symbol _SDL_PollEvent referenced in function _SDL_main
1>main-light.obj : error LNK2019: unresolved external symbol _SDL_SetVideoMode referenced in function _SDL_main
1>main-light.obj : error LNK2019: unresolved external symbol _SDL_Init referenced in function _SDL_main
1>MSVCRT.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
1>C:\Users\Tiago\Desktop\Projects\FPS\Debug\FPS.exe : fatal error LNK1120: 14 unresolved externals
here is the command line of the linker (if it can help you...):
/OUT:"C:\Users\Tiago\Desktop\Projects\FPS\Debug\FPS.exe" /NOLOGO "SDL.lib" "SDLmain.lib" "glu32.lib" "glut32.lib" "opengl32.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /MANIFEST /ManifestFile:"Debug\FPS.exe.intermediate.manifest" /ALLOWISOLATION /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\Users\Tiago\Desktop\Projects\FPS\Debug\FPS.pdb" /SUBSYSTEM:CONSOLE /PGD:"C:\Users\Tiago\Desktop\Projects\FPS\Debug\FPS.pgd" /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:QUEUE
More information:
i've put the OpenGL and SDL folder (the folder with the include and lib files) in the main folder of my project. Is it causing the problem?

I cannot find anything relevant in the SDL docs on how to configure your project properly. The header files gives some hints, it uses non-standard #defines to select the platform. Which explains the first set of linker errors, the DECLSPEC macro has to be set correctly. For some really mysterious reason it wants to rename main() as well, the reason for your last linker error. No clue why any of this is necessary, these kind of hacks tend to be used as a filter. As in, "can't figure this out by yourself, don't bug us with your other questions".
First thing you have to do: right-click your project, Properties, Linker, Advanced, Entry Point = SDL_main. Make your code look similar to this, I hard-coded the paths and told the linker what to link:
include "stdafx.h"
#define __WIN32__ // Non-standard define to select the platform
#include "c:/temp/sdl-1.2.15/include/sdl.h"
#pragma comment(lib, "c:/temp/sdl-1.2.15/lib/x86/sdl.lib")
int main(int argc, char* argv[])
{
SDL_Init(SDL_INIT_EVERYTHING); // Just an example
// etc...
return 0;
}
It linked correctly, that's all I tried. Running it requires sdl.dll in the same directory as your .exe. Good luck with it, sounds like you'll need it.

Related

How do I define a DllMain function in rust cdylib?

Is there a specific way to define a DllMain function in Rust? I have tried this:
use winapi::shared::ntdef::*;
use winapi::um::winnt::DLL_PROCESS_ATTACH;
use winapi::shared::minwindef::*;
use std::*;
#[no_mangle]
extern "stdcall" fn DllMain(hInstDll: HINSTANCE, fdwReason: DWORD, lpvReserved: LPVOID){
if fdwReason == DLL_PROCESS_ATTACH {
}
}
But windows doesn't seem to call the function when the dll is attached to a process?
Edit: Renaming function to _DllMainCRTStartup is recognized as an entry point by the compiler, but rust is unable to find the c-runtime libraries
`error: linking with 'link.exe' failed: exit code: 1120
|
= note: "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\link.exe" "/NOLOGO" "/NXCOMPAT" "/LIBPATH:C:\Users\Admin\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib" "C:\Users\Admin\source\repos\dandra_but_rust\target\debug\deps\dandra_but_rust.2zwdumngih9wy4mr.rcgu.o" "/OUT:C:\Users\Admin\source\repos\dandra_but_rust\target\debug\deps\dandra_but_rust.dll" "/DEF:C:\Users\Admin\AppData\Local\Temp\rustc7Q6l64\lib.def" "C:\Users\Admin\source\repos\dandra_but_rust\target\debug\deps\dandra_but_rust.2ir3c20pqmwv4eun.rcgu.o" "/OPT:REF,NOICF" "/DLL" "/IMPLIB:C:\Users\Admin\source\repos\dandra_but_rust\target\debug\deps\dandra_but_rust.dll.lib" "/DEBUG" "/NATVIS:C:\Users\Admin\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\etc\intrinsic.natvis" "/NATVIS:C:\Users\Admin\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\etc\liballoc.natvis" "/NATVIS:C:\Users\Admin\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\etc\libcore.natvis" "/NATVIS:C:\Users\Admin\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\etc\libstd.natvis" "/LIBPATH:C:\Users\Admin\source\repos\dandra_but_rust\target\debug\deps" "/LIBPATH:C:\Users\Admin\source\repos\dandra_but_rust\target\debug\build\minhook-sys-148df4753bb64a28\out" "/LIBPATH:C:\Users\Admin\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib" "C:\Users\Admin\source\repos\dandra_but_rust\target\debug\deps\libwinapi-1d830746c941a966.rlib" "C:\Users\Admin\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libstd-e5130808ccb074ce.rlib" "C:\Users\Admin\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libpanic_unwind-580326a9fdffe4b1.rlib" "C:\Users\Admin\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\librustc_demangle-a76d77b5d9ed4759.rlib" "C:\Users\Admin\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libhashbrown-d5a5b7aa7eeea0b8.rlib" "C:\Users\Admin\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\librustc_std_workspace_alloc-4b74b4985b95e6c8.rlib" "C:\Users\Admin\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libunwind-b2d5eb0d27518d1c.rlib" "C:\Users\Admin\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libcfg_if-8a162ec37e71ea47.rlib" "C:\Users\Admin\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\liblibc-45fb7c94b612099e.rlib" "C:\Users\Admin\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\liballoc-3c0db88c6c3c2080.rlib" "C:\Users\Admin\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\librustc_std_workspace_core-ae8fea3b9ef7193c.rlib" "C:\Users\Admin\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libcore-44bd5dbe4e29964c.rlib" "C:\Users\Admin\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libcompiler_builtins-2e1363d96f00dd60.rlib" "advapi32.lib" "cfgmgr32.lib" "credui.lib" "gdi32.lib" "kernel32.lib" "msimg32.lib" "ole32.lib" "opengl32.lib" "secur32.lib" "shell32.lib" "user32.lib" "winspool.lib" "advapi32.lib" "ws2_32.lib" "userenv.lib" "msvcrt.lib"
= note: LINK : warning LNK4216: Exported entry point _DllMainCRTStartup
Creating library C:\Users\Admin\source\repos\dandra_but_rust\target\debug\deps\dandra_but_rust.dll.lib and object C:\Users\Admin\source\repos\dandra_but_rust\target\debug\deps\dandra_but_rust.dll.exp
libstd-e5130808ccb074ce.rlib(std-e5130808ccb074ce.std.cergmp4c-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol __CxxFrameHandler3
libpanic_unwind-580326a9fdffe4b1.rlib(panic_unwind-580326a9fdffe4b1.panic_unwind.c9nntgss-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol __CxxFrameHandler3
liballoc-3c0db88c6c3c2080.rlib(alloc-3c0db88c6c3c2080.alloc.3pxpxezw-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol __CxxFrameHandler3
libstd-e5130808ccb074ce.rlib(std-e5130808ccb074ce.std.cergmp4c-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol memcpy referenced in function _ZN4core3fmt5Write10write_char17h1ad50f755d81c59eE
liballoc-3c0db88c6c3c2080.rlib(alloc-3c0db88c6c3c2080.alloc.3pxpxezw-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol memcpy
libcore-44bd5dbe4e29964c.rlib(core-44bd5dbe4e29964c.core.7rmb18uk-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol memcpy
libstd-e5130808ccb074ce.rlib(std-e5130808ccb074ce.std.cergmp4c-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol memset referenced in function _ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17h79aa7d690a3d5e88E
librustc_demangle-a76d77b5d9ed4759.rlib(rustc_demangle-a76d77b5d9ed4759.rustc_demangle.bwbqjk7y-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol memset
libcore-44bd5dbe4e29964c.rlib(core-44bd5dbe4e29964c.core.7rmb18uk-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol memset
libstd-e5130808ccb074ce.rlib(std-e5130808ccb074ce.std.cergmp4c-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol memmove referenced in function _ZN4core3ptr90drop_in_place$LT$std..io..buffered..bufwriter..BufWriter$LT$W$GT$..flush_buf..BufGuard$GT$17hedcaf5acf9e62584E
liballoc-3c0db88c6c3c2080.rlib(alloc-3c0db88c6c3c2080.alloc.3pxpxezw-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol memmove
libstd-e5130808ccb074ce.rlib(std-e5130808ccb074ce.std.cergmp4c-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol memcmp referenced in function _ZN5alloc11collections5btree3map21BTreeMap$LT$K$C$V$GT$6insert17hc358a9b81795c956E
librustc_demangle-a76d77b5d9ed4759.rlib(rustc_demangle-a76d77b5d9ed4759.rustc_demangle.bwbqjk7y-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol memcmp
libcore-44bd5dbe4e29964c.rlib(core-44bd5dbe4e29964c.core.7rmb18uk-cgu.0.rcgu.o) : error LNK2001: unresolved external symbol memcmp
libstd-e5130808ccb074ce.rlib(std-e5130808ccb074ce.std.cergmp4c-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol strlen referenced in function _ZN3std3ffi5c_str7CString8from_raw17h67ae0c016f9720bbE
libpanic_unwind-580326a9fdffe4b1.rlib(panic_unwind-580326a9fdffe4b1.panic_unwind.c9nntgss-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol _CxxThrowException referenced in function _ZN12panic_unwind8real_imp5panic17hd7ecf9c6caff3a53E
msvcrt.lib(delete_scalar.obj) : error LNK2019: unresolved external symbol free referenced in function "void __cdecl operator delete(void *)" (??3#YAXPEAX#Z)
C:\Users\Admin\source\repos\dandra_but_rust\target\debug\deps\dandra_but_rust.dll : fatal error LNK1120: 8 unresolved externals
error: aborting due to previous error
error: could not compile 'dandra_but_rust'`

How to solve link errors while MediaFoundation using?

I have a solution that is works, then I was needed to add a project that has implementation of MediaFoundation. So, in order to include it I added this project as existing one then in configuration in General section I provided path to .h files and then in Liker input added .lib
After this I tried to use it and write include in one of my files and then invoked a few methods from this project that was added.
When I tried to compile my project I got an errors :
9>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2019: unresolved external symbol MFStartup referenced in function "private: bool __cdecl co_AudioDecoderMF::InitAndStartCOMLib(void)" (?InitAndStartCOMLib#co_AudioDecoderMF##AEAA_NXZ)
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2019: unresolved external symbol MFShutdown referenced in function "public: virtual void __cdecl co_AudioDecoderMF::Cleanup(void)" (?Cleanup#co_AudioDecoderMF##UEAAXXZ)
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2019: unresolved external symbol MFCreateAttributes referenced in function "private: bool __cdecl co_AudioDecoderMF::CreateSourceReader(void)" (?CreateSourceReader#co_AudioDecoderMF##AEAA_NXZ)
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2019: unresolved external symbol MFCreateMediaType referenced in function "private: bool __cdecl co_AudioDecoderMF::ConfigureAudioStream(enum co_AudioDecoder::SoundDataType,struct IMFSourceReader *,struct IMFMediaType * *)" (?ConfigureAudioStream#co_AudioDecoderMF##AEAA_NW4SoundDataType#co_AudioDecoder##PEAUIMFSourceReader##PEAPEAUIMFMediaType###Z)
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2019: unresolved external symbol MFCreateMFByteStreamOnStream referenced in function "private: bool __cdecl co_AudioDecoderMF::CreateByteStream(unsigned char const *,__int64)" (?CreateByteStream#co_AudioDecoderMF##AEAA_NPEBE_J#Z)
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2019: unresolved external symbol MFCreateSourceReaderFromByteStream referenced in function "private: bool __cdecl co_AudioDecoderMF::CreateSourceReader(void)" (?CreateSourceReader#co_AudioDecoderMF##AEAA_NXZ)
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2001: unresolved external symbol MFAudioFormat_PCM
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2001: unresolved external symbol MF_MT_MAJOR_TYPE
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2001: unresolved external symbol MF_MT_SUBTYPE
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2001: unresolved external symbol MF_MT_AUDIO_NUM_CHANNELS
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2001: unresolved external symbol MF_MT_AUDIO_SAMPLES_PER_SECOND
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2001: unresolved external symbol MF_MT_AUDIO_BLOCK_ALIGNMENT
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2001: unresolved external symbol MF_MT_AUDIO_BITS_PER_SAMPLE
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2001: unresolved external symbol MFMediaType_Audio
First of all it is strange because I have already use this project in other solution and there weren't problems, but ok after a research I have found out that I need to add in configuration Linker -> input a few more .libs
Mf.lib
Mfplat.lib
mfuuid.lib
(inspire of I don't have these lines in my other solution where does it works) and after I added these lines a lot of error gone, but one left
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2019: unresolved external symbol MFCreateSourceReaderFromByteStream referenced in function "private: bool __cdecl co_AudioDecoderMF::CreateSourceReader(void)" (?CreateSourceReader#co_AudioDecoderMF##AEAA_NXZ)
And I have not found nothing about how to solve it. I am a relatively new in c++ and it looks weird that in order to make MediaFoundation(big lib) work I need to spend a few hours in order to find out what to add in additional in order to make it works.
So, question is - what am I missing here?
You need to include this :
#pragma comment(lib, "mfreadwrite")
Documentation usually helps :
MFCreateSourceReaderFromByteStream function

error lnk2019 unresolved external symbol public __thiscall sfml audio module

Im having great troubles compiling a simple test project using with SFML.
I have seen many errors similar to the ones Im getting on the internet but everything i tried failed.
I am static linking sfml.
In the project's properties, I added the path to the SFML headers and the SFML libraries.
I have define the SFML_STATIC macro in the preprocessor options of my project.
I added modules and their dependencies like so :
sfml-audio-s.lib sfml-audio-s-d.lib sfml-graphics-s.lib
sfml-graphics-s-d.lib sfml-window-s.lib sfml-window-s-d.lib
sfml-system-s.lib sfml-system-s-d.lib opengl32.lib freetype.lib
jpeg.lib winmm.lib flac.lib vorbis.lib vorbisenc.lib vorbisfile.lib
ogg.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
odbccp32.lib
I even added the dll files in my executable folder even though its not necessary when static building.
here is my code :
#include "stdafx.h"
#include <SFML/Audio.hpp>
#include <iostream>
#include <stdlib.h>
int _tmain(int argc, _TCHAR* argv[])
{
std::cout << "helloo" << std::endl;
sf::SoundBuffer buffer;
if (!buffer.loadFromFile("A4.wav"))
std::cout << "cant open file" << std::endl;
sf::Sound sound;
sound.setBuffer(buffer);
sound.play();
_sleep(5000);
return 42;
}
And now here is the errors I get :
1>AudioTest.obj : error LNK2019: unresolved external symbol "public: __thiscall sf::SoundBuffer::~SoundBuffer(void)" (??1SoundBuffer#sf##QAE#XZ) referenced in function _wmain
1>AudioTest.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall sf::Sound::~Sound(void)" (??1Sound#sf##UAE#XZ) referenced in function _wmain
1>AudioTest.obj : error LNK2019: unresolved external symbol "public: void __thiscall sf::Sound::play(void)" (?play#Sound#sf##QAEXXZ) referenced in function _wmain
1>AudioTest.obj : error LNK2019: unresolved external symbol "public: void __thiscall sf::Sound::setBuffer(class sf::SoundBuffer const &)" (?setBuffer#Sound#sf##QAEXABVSoundBuffer#2##Z) referenced in function _wmain
1>AudioTest.obj : error LNK2019: unresolved external symbol "public: __thiscall sf::Sound::Sound(void)" (??0Sound#sf##QAE#XZ) referenced in function _wmain
1>AudioTest.obj : error LNK2019: unresolved external symbol "public: bool __thiscall sf::SoundBuffer::loadFromFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?loadFromFile#SoundBuffer#sf##QAE_NABV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std###Z) referenced in function _wmain
1>AudioTest.obj : error LNK2019: unresolved external symbol "public: __thiscall sf::SoundBuffer::SoundBuffer(void)" (??0SoundBuffer#sf##QAE#XZ) referenced in function _wmain
additionnal infos :
Im using visual studio 2010 express.
I downloaded "SFML 2.3 Visual C++ 10 (2010) - 64-bit".
any help appreciated.
EDIT : as I said I tried many things, I have read a LOT of stack overflow or other forums posts, nothing worked... I have been stuck on this for 2 weeks now.
I'd really appreciate some help

Selecting a Capture Device Using the System Device Enumerator

I was tring to use this link: http://msdn.microsoft.com/en-us/library/dd377566%28v=VS.85%29.aspx, to select a capturing device.
Works perfectly on Visual Studio, but throws the following error QT:
test.obj : error LNK2005: _main already defined in main.obj
test.obj : error LNK2019: unresolved external symbol __imp__CoCreateInstance#20 referenced in function "long __cdecl EnumerateDevices(struct _GUID const &,struct IEnumMoniker * *)" (?EnumerateDevices##YAJABU_GUID##PAPAUIEnumMoniker###Z)
test.obj : error LNK2019: unresolved external symbol __imp__VariantClear#4 referenced in function "void __cdecl DisplayDeviceInformation(struct IEnumMoniker *)" (?DisplayDeviceInformation##YAXPAUIEnumMoniker###Z)
test.obj : error LNK2019: unresolved external symbol __imp__VariantInit#4 referenced in function "void __cdecl DisplayDeviceInformation(struct IEnumMoniker *)" (?DisplayDeviceInformation##YAXPAUIEnumMoniker###Z)
test.obj : error LNK2019: unresolved external symbol __imp__CoUninitialize#0 referenced in function _main
test.obj : error LNK2019: unresolved external symbol __imp__CoInitializeEx#8 referenced in function _main
I'm using windows 7 & QT 5.0.2.
Any help will be appreciated thanks.
Searching for "cocreateinstance unresolved external" on google and using the first link returned:
http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/5fc032e1-86d8-43c7-870b-f10599000605/
I spotted the third comment that indicates to link against "ole32.lib".
Your reply to my comment above indicates that "oleAut32.lib" is also required.
Also make sure to link against "strmiids.lib".
To sum up, required libraries are:
ole32.lib
oleaut32.lib
strmiids.lib

unresolved external symbol in eclipse cdt

I try to build cpp file using eclipse cdt. Linker throws "unresolved external symbol", however path to lib file that contains implementation for function is listed in LIB environment variable on Project properties->C/C++ Build->Environment
What am I doing wrong?
UPD I try to build file. There is lib RpcRT4.Lib on the path C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib\
And linker fails:
**** Build of configuration Debug for project test cpp ****
**** Internal Builder is used for build ****
link /debug /nologo /OUT:test cpp.exe main.obj
main.obj : error LNK2019: unresolved external symbol __imp__RpcStringFreeA#4 referenced in function "bool __cdecl Initialize_CreateWindowClass(void)"(?Initialize_CreateWindowClass##YA_NXZ)
main.obj : error LNK2019: unresolved external symbol __imp__RegisterClassA#4 referenced in function "bool __cdecl Initialize_CreateWindowClass(void)" (?Initialize_CreateWindowClass##YA_NXZ)
main.obj : error LNK2019: unresolved external symbol __imp__UuidToStringA#8 referenced in function "bool __cdecl Initialize_CreateWindowClass(void)" (?Initialize_CreateWindowClass##YA_NXZ)
main.obj : error LNK2019: unresolved external symbol __imp__UuidCreate#4 referenced in function "bool __cdecl Initialize_CreateWindowClass(void)" (?Initialize_CreateWindowClass##YA_NXZ)
main.obj : error LNK2019: unresolved external symbol __imp__DefWindowProcA#16 referenced in function "long __stdcall SkypeAPITest_Windows_WindowProc(struct HWND__ *,unsigned int,unsigned int,long)" (?SkypeAPITest_Windows_WindowProc##YGJPAUHWND__##IIJ#Z)
main.obj : error LNK2019: unresolved external symbol __imp__PostQuitMessage#4 referenced in function "long __stdcall SkypeAPITest_Windows_WindowProc(struct HWND__ *,unsigned int,unsigned int,long)" (?SkypeAPITest_Windows_WindowProc##YGJPAUHWND__##IIJ#Z)
main.obj : error LNK2019: unresolved external symbol __imp__UnregisterClassA#8 referenced in function "void __cdecl DeInitialize_DestroyWindowClass(void)" (?DeInitialize_DestroyWindowClass##YAXXZ)
main.obj : error LNK2019: unresolved external symbol __imp__CreateWindowExA#48 referenced in function "bool __cdecl Initialize_CreateMainWindow(void)" (?Initialize_CreateMainWindow##YA_NXZ)
main.obj : error LNK2019: unresolved external symbol __imp__DestroyWindow#4 referenced in function "void __cdecl DeInitialize_DestroyMainWindow(void)" (?DeInitialize_DestroyMainWindow##YAXXZ)
main.obj : error LNK2019: unresolved external symbol __imp__DispatchMessageA#4 referenced in function "void __cdecl Global_MessageLoop(void)" (?Global_MessageLoop##YAXXZ)
main.obj : error LNK2019: unresolved external symbol __imp__TranslateMessage#4 referenced in function "void __cdecl Global_MessageLoop(void)" (?Global_MessageLoop##YAXXZ)
main.obj : error LNK2019: unresolved external symbol __imp__GetMessageA#16 referenced in function "void __cdecl Global_MessageLoop(void)" (?Global_MessageLoop##YAXXZ)
main.obj : error LNK2019: unresolved external symbol __imp__PostMessageA#16 referenced in function "void __cdecl Global_InputProcessingThread(void *)" (?Global_InputProcessingThread##YAXPAX#Z)
main.obj : error LNK2019: unresolved external symbol __imp__SendMessageA#16 referenced in function "void __cdecl Global_InputProcessingThread(void *)" (?Global_InputProcessingThread##YAXPAX#Z)
main.obj : error LNK2019: unresolved external symbol __imp__RegisterWindowMessageA#4 referenced in function _main
test cpp.exe : fatal error LNK1120: 15 unresolved externals
Build error occurred, build is stopped
Time consumed: 2438 ms.
And environment settings for project
I'm not entirely clear on whether you've already done this based on the question, but just adding the directory to your linker's search path isn't enough for any compiler/linker I've ever used. There could be hundreds of different libraries in there, even different versions of the same library, and the linker has no idea which ones you do and don't want. You need to tell it, explicitly, to link against the library using the appropriate parameter.
It looks like you're using the Microsoft linker, which I've never used, so I can't help you with the specific flag but it should be easy enough to find what it is in the documentation if that's the issue. I presume Eclipse has a method of specifying this in the GUI as well which should be generic across the various compilers it supports.