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
Related
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
I am a newbie to C++. I want to use, lacewing-project.org in my C++ project. I read the documentation on how to build it and successfully did it using both DLL - Release and Static Library - Release configurations.
Now I don't know how to use this in my project and how to setup and configure my project? I was following this tutorial, but was stuck in the middle because of missing options in the latest Visual Studio. I use Visual C++ Expression Ed., 2012 on Windows 8
I googled and did the following:
Added the lib file and the lacewing.h file in my project.
Under Visual C++ Project Properties, in the Linker folder -> Input I added the lib file as Additional Dependencies.
I placed the dll in Windows\System32 folder. Will I need to do anything with the dll other than placing it in win32 folder?
My code is from the hello world example given in the documentation.
When I try to compile I get:
1>------ Build started: Project: test, Configuration: Debug Win32 ------
1> Source.cpp
1>Source.obj : error LNK2019: unresolved external symbol __imp__lw_version referenced in function "void __cdecl on_get(struct lacewing::_webserver *,struct lacewing::_webserver_request *)" (?on_get##YAXPAU_webserver#lacewing##PAU_webserver_request#2##Z)
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl lacewing::pump_delete(struct lacewing::_pump *)" (__imp_?pump_delete#lacewing##YAXPAU_pump#1##Z) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: struct lacewing::_error * __thiscall lacewing::_eventpump::start_eventloop(void)" (__imp_?start_eventloop#_eventpump#lacewing##QAEPAU_error#2#XZ) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) struct lacewing::_eventpump * __cdecl lacewing::eventpump_new(void)" (__imp_?eventpump_new#lacewing##YAPAU_eventpump#1#XZ) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl lacewing::_stream::writef(char const *,...)" (__imp_?writef#_stream#lacewing##QAAXPBDZZ) referenced in function "void __cdecl on_get(struct lacewing::_webserver *,struct lacewing::_webserver_request *)" (?on_get##YAXPAU_webserver#lacewing##PAU_webserver_request#2##Z)
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall lacewing::_webserver::host(long)" (__imp_?host#_webserver#lacewing##QAEXJ#Z) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall lacewing::_webserver::on_get(void (__cdecl*)(struct lacewing::_webserver *,struct lacewing::_webserver_request *))" (__imp_?on_get#_webserver#lacewing##QAEXP6AXPAU12#PAU_webserver_request#2##Z#Z) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) struct lacewing::_webserver * __cdecl lacewing::webserver_new(struct lacewing::_pump *)" (__imp_?webserver_new#lacewing##YAPAU_webserver#1#PAU_pump#1##Z) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl lacewing::webserver_delete(struct lacewing::_webserver *)" (__imp_?webserver_delete#lacewing##YAXPAU_webserver#1##Z) referenced in function _main
1>C:\Users\Jayarathina\Desktop\New folder (3)\test\Debug\test.exe : fatal error LNK1120: 9 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Please help...
To link statically with the library, one must define lw_import. If you don't do this, it will default to __declspec(dllimport):
#ifndef lw_import
#define lw_import __declspec (dllimport)
#endif
which causes the linker to try and pull the functions in from a DLL (which is wrong when statically linking). To do this, you can either add lw_import= to your preprocessor definitions in the project properties, or #define it before including lacewing.h, as so:
#define lw_import
#include <lacewing.h>
As you're statically linking the library, you will also need to link any library dependencies into your own project. You can find the list in the project properties of liblacewing.vcproj itself, but as of 0.5.1 these are ws2_32.lib, mswsock.lib, mpr.lib, secur32.lib and crypt32.lib.
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.
Since SCons has been deprecated. I used the gyp to generate vs solution.
I did what they told me on the build BuildingWithGYP.
And the v8 project builded ok!
and I got the v8_base.lib but no v8.lib.
And in the hello world project ,get started.I add the lib directory into the add library.
But it linked failed:
Linking...
1>v8test.obj : error LNK2019: unresolved external symbol "public:
__thiscall v8::HandleScope::~HandleScope(void)" (??
1HandleScope#v8##QAE#XZ) referenced in function _main
1>v8test.obj : error LNK2019: unresolved external symbol "public:
__thiscall v8::String::AsciiValue::~AsciiValue(void)" (??
1AsciiValue#String#v8##QAE#XZ) referenced in function _main
1>v8test.obj : error LNK2019: unresolved external symbol "public:
__thiscall v8::String::AsciiValue::AsciiValue(class v8::Handle<class
v8::Value>)" (??0AsciiValue#String#v8##QAE#V?$Handle#VValue#v8###2##Z)
referenced in function _main
1>v8test.obj : error LNK2019: unresolved external symbol "public:
class v8::Local<class v8::Value> __thiscall v8::Script::Run(void)" (?
Run#Script#v8##QAE?AV?$Local#VValue#v8###2#XZ) referenced in function
_main
……
It seems that couldn't find the implement
but i used the dumpbin tool and find the symbol i can find them in the v8_base.lib
I am sure that the library directory is ok!
but i don't know why it couldn't find the implement.
You can add the lib "v8_base.lib" as an additional dependency to fix the problem.
I am creating an torrent application using libtorrent in VS 2008. I tried the example given in the link http://www.rasterbar.com/products/libtorrent/examples.html
BUt it is showing me these error....how to solve them?
Linking...
main.obj : error LNK2019: unresolved external symbol "public: __thiscall libtorrent::torrent_info::~torrent_info(void)" (??1torrent_info#libtorrent##QAE#XZ) referenced in function _main
main.obj : error LNK2019: unresolved external symbol "public: __thiscall libtorrent::torrent_info::torrent_info(struct libtorrent::lazy_entry const &)" (??0torrent_info#libtorrent##QAE#ABUlazy_entry#1##Z) referenced in function _main
main.obj : error LNK2019: unresolved external symbol "class std::basic_ostream > & __cdecl libtorrent::operator<<(class std::basic_ostream > &,struct libtorrent::lazy_entry const &)" (??6libtorrent##YAAAV?$basic_ostream#DU?$char_traits#D#std###std##AAV12#ABUlazy_entry#0##Z) referenced in function _main
main.obj : error LNK2019: unresolved external symbol "int __cdecl libtorrent::lazy_bdecode(char const *,char const *,struct libtorrent::lazy_entry &,int)" (?lazy_bdecode#libtorrent##YAHPBD0AAUlazy_entry#1#H#Z) referenced in function _main
main.obj : error LNK2019: unresolved external symbol "public: void __thiscall libtorrent::lazy_entry::clear(void)" (?clear#lazy_entry#libtorrent##QAEXXZ) referenced in function "public: __thiscall libtorrent::lazy_entry::~lazy_entry(void)" (??1lazy_entry#libtorrent##QAE#XZ)
main.obj : error LNK2019: unresolved external symbol "void __cdecl libtorrent::to_hex(char const *,int,char *)" (?to_hex#libtorrent##YAXPBDHPAD#Z) referenced in function "class std::basic_ostream > & __cdecl libtorrent::operator<<(class std::basic_ostream > &,class libtorrent::big_number const &)" (??6libtorrent##YAAAV?$basic_ostream#DU?$char_traits#D#std###std##AAV12#ABVbig_number#0##Z)
main.obj : error LNK2019: unresolved external symbol "public: struct libtorrent::peer_request __thiscall libtorrent::file_storage::map_file(int,__int64,int)const " (?map_file#file_storage#libtorrent##QBE?AUpeer_request#2#H_JH#Z) referenced in function "public: struct libtorrent::peer_request __thiscall libtorrent::torrent_info::map_file(int,__int64,int)const " (?map_file#torrent_info#libtorrent##QBE?AUpeer_request#2#H_JH#Z)
C:\Users\photoshop3\Documents\Visual Studio 2008\Projects\Lib2\Debug\Lib2.exe : fatal error LNK1120: 7 unresolved externals
The .lib is not included in your project. Make sure you are linking it in;
Configuration Properties -> Linker -> Input -> Additional Dependencies
Another altnerative is to simply copy the .lib to your project folder but don't, it's bound to create problems later on.
Sometimes the .lib is not shipped with the library, so you need to compile it yourself.
The README will tell you this. If this is the case, they usually ship with a .sln file you can open and the just compile it into a .lib file which you then reference in your main application, as I wrote above
Have you added the path of header files in the "Configuration Properties" --> "C/C++“ --> "General" --> "Additional Include Directories"?
The link gives you only the sources (including headerfiles) of libtorrent. You should compile this sources to get a .lib file. Add this .lib file to your client:
Configuration Properties/Linker/Input -> Additional Dependencies: libtorrent-rasterbar.lib
The best starting point for compiling should be the README file.
public: isn't the unresolved symbol. It's just there because the linker it trying to tell you that (most) of the unresolved symbols are public member functions.
It looks like you've included the header for "libtorrent", but not linked to the "libtorrent" library.
You have probably not linked with the torrent library or specified the wrong path to it so that the linker cannot find it.
If the input libraries are of 32bit and your are using them in building a 64bit it might be one of the reasons
For me, I had it included in my project, but it turned out that it was a plugin that was designed to not create an instance of in my unit test.