I am quite new to C++ so I downloaded a sample C++ program. The sample program seems to hit the following error when it is compiling :-
Error 22 error LNK2019: unresolved external symbol _acsEnumServerNames#12 referenced in function "protected: virtual int __thiscall COpenTsrv::OnInitDialog(void)" (?OnInitDialog#COpenTsrv##MAEHXZ) Opentsrv.obj
I traced it to the referred function but I do not know anything wrong with it ?
BOOL COpenTsrv::OnInitDialog()
{
CDialog::OnInitDialog();
CenterWindow();
acsEnumServerNames(ST_CSTA, AddToList, (unsigned long) (CComboBox*)&m_TserverListControl);
UpdateData(FALSE);
The following is the build log. Apparently there are still other errors but would like to start with the first one.
1>Generating Code...
1>Compiling resources...
1>Compiling manifest to resources...
1>Linking...
1>Opentsrv.obj : error LNK2019: unresolved external symbol _acsEnumServerNames#12 referenced in function "protected: virtual int __thiscall COpenTsrv::OnInitDialog(void)" (? OnInitDialog#COpenTsrv##MAEHXZ)
1>Opentsrv.obj : error LNK2019: unresolved external symbol _acsQueryAuthInfo#8 referenced in function "protected: void __thiscall COpenTsrv::OnSelchangeTserverlist(void)" (?OnSelchangeTserverlist#COpenTsrv##IAEXXZ)
1>Opentsrv.obj : error LNK2019: unresolved external symbol _acsAbortStream#8 referenced in function "protected: virtual void __thiscall COpenTsrv::OnOK(void)" (?OnOK#COpenTsrv##MAEXXZ)
1>Tsapi.obj : error LNK2001: unresolved external symbol _acsAbortStream#8
1>Opentsrv.obj : error LNK2019: unresolved external symbol _acsEventNotify#16 referenced in function "protected: virtual void __thiscall COpenTsrv::OnOK(void)" (?OnOK#COpenTsrv##MAEXXZ)
1>Opentsrv.obj : error LNK2019: unresolved external symbol _acsOpenStream#60 referenced in function "protected: virtual void __thiscall COpenTsrv::OnOK(void)" (?OnOK#COpenTsrv##MAEXXZ)
1>Opentsrv.obj : error LNK2019: unresolved external symbol _cstaMonitorDevice#20 referenced in function "protected: long __thiscall COpenTsrv::OnTsapiAcsConfirmation(unsigned int,long)" (?OnTsapiAcsConfirmation#COpenTsrv##IAEJIJ#Z)
1>Sampldlg.obj : error LNK2019: unresolved external symbol _cstaMakeCall#20 referenced in function "protected: void __thiscall CSampleDlg::OnCall(void)" (?OnCall#CSampleDlg##IAEXXZ)
1>Sampldlg.obj : error LNK2019: unresolved external symbol _cstaClearConnection#16 referenced in function "protected: void __thiscall CSampleDlg::OnHangup(void)" (?OnHangup#CSampleDlg##IAEXXZ)
1>Sampldlg.obj : error LNK2019: unresolved external symbol _cstaAnswerCall#16 referenced in function "protected: void __thiscall CSampleDlg::OnAnswer(void)" (?OnAnswer#CSampleDlg##IAEXXZ)
1>Tsapi.obj : error LNK2019: unresolved external symbol _acsGetEventPoll#20 referenced in function "protected: long __thiscall CTsapiWnd::OnTsapiMsg(unsigned int,long)" (?OnTsapiMsg#CTsapiWnd##IAEJIJ#Z)
1>C:\Users\steventang\Documents\Visual Studio 2005\Projects\TSAPINEW\Debug\TSAPINEW.exe : fatal error LNK1120: 10 unresolved externals
1>Build log was saved at "file://c:\Users\steventang\Documents\Visual Studio 2005\Projects\TSAPINEW\TSAPINEW\Debug\BuildLog.htm"
1>TSAPINEW - 12 error(s), 21 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
Any help to point me to the right direction would very much be appreciated.
Thanks
Seems like your compilation was sucessfull. Only the linking did not work.
Probably the linker is complaining because you defined the header of the method "acsEnumServerNames" but you did not provide an implementation of the method.
Maybe you used a header-file but you did not provide the library to which the header belongs ?
Find out to which pakage "acsEnumServerNames" belongs and check if you have the implementation of the method in some .c/.cpp file, or if the implementation should be provided by some library on which you do rely.
Related
I'm trying to compile the zeromq sources and I have the following error:
I'm using Visual studio 2013 update 4 / windows 7 x64
First of all I compile the libsodium library satisfactorily.
Then I link the libsodium header files directory path to additional dependencies and libsodium.lib to additional library directories. I also specify the name of library in additional dependencies.
I try to compile it under win32 architecture and x64 architecture but I get the same errors.
I know that a __imp prefix is used as a bridge to the function that I want to use so if I linked the libraries appropiately why do I get this error?
Console log:
1>Creating library E:\zmq\libzmq\builds\msvc\vs2013\libzmq\..\..\..\..\bin\Win32\Debug\v120\dynamic\libzmq.lib and object E:\zmq\libzmq\builds\msvc\vs2013\libzmq\..\..\..\..\bin\Win32\Debug\v120\dynamic\libzmq.exp
1>ctx.obj : error LNK2019: unresolved external symbol __imp__randombytes_close referenced in function "public: __thiscall zmq::ctx_t::~ctx_t(void)" (??1ctx_t#zmq##QAE#XZ)
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__sodium_init referenced in function "public: __thiscall zmq::curve_client_t::curve_client_t(struct zmq::options_t const &)" (??0curve_client_t#zmq##QAE#ABUoptions_t#1##Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__sodium_init
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__crypto_box_keypair referenced in function "public: __thiscall zmq::curve_client_t::curve_client_t(struct zmq::options_t const &)" (??0curve_client_t#zmq##QAE#ABUoptions_t#1##Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__crypto_box_keypair
1>zmq_utils.obj : error LNK2001: unresolved external symbol __imp__crypto_box_keypair
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__crypto_box_beforenm referenced in function "private: int __thiscall zmq::curve_client_t::process_welcome(unsigned char const *,unsigned int)" (?process_welcome#curve_client_t#zmq##AAEHPBEI#Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__crypto_box_beforenm
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__crypto_box referenced in function "private: int __thiscall zmq::curve_client_t::produce_hello(class zmq::msg_t *)" (?produce_hello#curve_client_t#zmq##AAEHPAVmsg_t#2##Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__crypto_box
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__crypto_box_open referenced in function "private: int __thiscall zmq::curve_client_t::process_welcome(unsigned char const *,unsigned int)" (?process_welcome#curve_client_t#zmq##AAEHPBEI#Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__crypto_box_open
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__crypto_box_afternm referenced in function "public: virtual int __thiscall zmq::curve_client_t::encode(class zmq::msg_t *)" (?encode#curve_client_t#zmq##UAEHPAVmsg_t#2##Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__crypto_box_afternm
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__crypto_box_open_afternm referenced in function "public: virtual int __thiscall zmq::curve_client_t::decode(class zmq::msg_t *)" (?decode#curve_client_t#zmq##UAEHPAVmsg_t#2##Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__crypto_box_open_afternm
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__randombytes referenced in function "private: int __thiscall zmq::curve_client_t::produce_initiate(class zmq::msg_t *)" (?produce_initiate#curve_client_t#zmq##AAEHPAVmsg_t#2##Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__randombytes
1>curve_server.obj : error LNK2019: unresolved external symbol __imp__crypto_secretbox referenced in function "private: int __thiscall zmq::curve_server_t::produce_welcome(class zmq::msg_t *)" (?produce_welcome#curve_server_t#zmq##AAEHPAVmsg_t#2##Z)
1>curve_server.obj : error LNK2019: unresolved external symbol __imp__crypto_secretbox_open referenced in function "private: int __thiscall zmq::curve_server_t::process_initiate(class zmq::msg_t *)" (?process_initiate#curve_server_t#zmq##AAEHPAVmsg_t#2##Z)
Thanks in advance.
You're probably compiling libsodium in a static way.
Try to compile it dinamically and link it again.
Such errors are also able to occur when you have a wrong set calling convention at your project.
I have a Qt project that uses OpenGL and compiles fine with Qt 5.4.0. Today I upgraded my Qt to 5.5.0 and my project stopped compiling. It throws a lot of unresolved external symbol errors as you can see here:
link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST:embed /OUT:debug\UI.exe #C:\Users\DWilches\AppData\Local\Temp\UI.exe.376.5500.jom
UIOpenGLVisualizer.obj : error LNK2019: unresolved external symbol __imp__glBegin#4 referenced in function "public: virtual void __thiscall UIOpenGLVisualizer::paintGL(void)" (?paintGL#UIOpenGLVisualizer##UAEXXZ)
UIOpenGLVisualizer.obj : error LNK2019: unresolved external symbol __imp__glClearDepth#8 referenced in function "public: virtual void __thiscall UIOpenGLVisualizer::initializeGL(void)" (?initializeGL#UIOpenGLVisualizer##UAEXXZ)
UIOpenGLVisualizer.obj : error LNK2019: unresolved external symbol __imp__glColor3f#12 referenced in function "public: virtual void __thiscall UIOpenGLVisualizer::paintGL(void)" (?paintGL#UIOpenGLVisualizer##UAEXXZ)
UIOpenGLVisualizer.obj : error LNK2019: unresolved external symbol __imp__glColor4f#16 referenced in function "private: void __thiscall UIOpenGLVisualizer::PaintScene(void)" (?PaintScene#UIOpenGLVisualizer##AAEXXZ)
UIOpenGLVisualizer.obj : error LNK2019: unresolved external symbol __imp__glEnd#0 referenced in function "public: virtual void __thiscall UIOpenGLVisualizer::paintGL(void)" (?paintGL#UIOpenGLVisualizer##UAEXXZ)
UIOpenGLVisualizer.obj : error LNK2019: unresolved external symbol __imp__glFrustum#48 referenced in function "public: virtual void __thiscall UIOpenGLVisualizer::paintGL(void)" (?paintGL#UIOpenGLVisualizer##UAEXXZ)
UIOpenGLVisualizer.obj : error LNK2019: unresolved external symbol __imp__glInitNames#0 referenced in function "public: void __thiscall UIOpenGLVisualizer::NewSelectionPerformed(void)" (?NewSelectionPerformed#UIOpenGLVisualizer##QAEXXZ)
UIOpenGLVisualizer.obj : error LNK2019: unresolved external symbol __imp__glLineStipple#8 referenced in function "public: virtual void __thiscall UIOpenGLVisualizer::initializeGL(void)" (?initializeGL#UIOpenGLVisualizer##UAEXXZ)
UIOpenGLVisualizer.obj : error LNK2019: unresolved external symbol __imp__glLoadIdentity#0 referenced in function "public: virtual void __thiscall UIOpenGLVisualizer::initializeGL(void)" (?initializeGL#UIOpenGLVisualizer##UAEXXZ)
UIOpenGLVisualizer.obj : error LNK2019: unresolved external symbol __imp__glLoadName#4 referenced in function "public: void __thiscall UIOpenGLVisualizer::NewSelectionPerformed(void)" (?NewSelectionPerformed#UIOpenGLVisualizer##QAEXXZ)
UIOpenGLVisualizer.obj : error LNK2019: unresolved external symbol __imp__glMatrixMode#4 referenced in function "public: virtual void __thiscall UIOpenGLVisualizer::initializeGL(void)" (?initializeGL#UIOpenGLVisualizer##UAEXXZ)
UIOpenGLVisualizer.obj : error LNK2019: unresolved external symbol __imp__glOrtho#48 referenced in function "public: virtual void __thiscall UIOpenGLVisualizer::initializeGL(void)" (?initializeGL#UIOpenGLVisualizer##UAEXXZ)
UIOpenGLVisualizer.obj : error LNK2019: unresolved external symbol __imp__glPointSize#4 referenced in function "public: virtual void __thiscall UIOpenGLVisualizer::initializeGL(void)" (?initializeGL#UIOpenGLVisualizer##UAEXXZ)
UIOpenGLVisualizer.obj : error LNK2019: unresolved external symbol __imp__glPushName#4 referenced in function "public: void __thiscall UIOpenGLVisualizer::NewSelectionPerformed(void)" (?NewSelectionPerformed#UIOpenGLVisualizer##QAEXXZ)
UIOpenGLVisualizer.obj : error LNK2019: unresolved external symbol __imp__glRenderMode#4 referenced in function "public: void __thiscall UIOpenGLVisualizer::NewSelectionPerformed(void)" (?NewSelectionPerformed#UIOpenGLVisualizer##QAEXXZ)
UIOpenGLVisualizer.obj : error LNK2019: unresolved external symbol __imp__glRotatef#16 referenced in function "public: void __thiscall UIOpenGLVisualizer::NewSelectionPerformed(void)" (?NewSelectionPerformed#UIOpenGLVisualizer##QAEXXZ)
UIOpenGLVisualizer.obj : error LNK2019: unresolved external symbol __imp__glScalef#12 referenced in function "public: void __thiscall UIOpenGLVisualizer::NewSelectionPerformed(void)" (?NewSelectionPerformed#UIOpenGLVisualizer##QAEXXZ)
UIOpenGLVisualizer.obj : error LNK2019: unresolved external symbol __imp__glSelectBuffer#8 referenced in function "public: void __thiscall UIOpenGLVisualizer::NewSelectionPerformed(void)" (?NewSelectionPerformed#UIOpenGLVisualizer##QAEXXZ)
UIOpenGLVisualizer.obj : error LNK2019: unresolved external symbol __imp__glTranslatef#12 referenced in function "public: virtual void __thiscall UIOpenGLVisualizer::paintGL(void)" (?paintGL#UIOpenGLVisualizer##UAEXXZ)
UIOpenGLVisualizer.obj : error LNK2019: unresolved external symbol __imp__glVertex3f#12 referenced in function "public: virtual void __thiscall UIOpenGLVisualizer::paintGL(void)" (?paintGL#UIOpenGLVisualizer##UAEXXZ)
debug\UI.exe : fatal error LNK1120: 20 unresolved externals
jom: C:\Users\DWilches\Desktop\3DIA\VolumeSelector\VVSIT\build-VVSIT-Desktop_Qt_5_5_0_MSVC2013_32bit-Debug\UI\Makefile.Debug [debug\UI.exe] Error 1120
jom: C:\Users\DWilches\Desktop\3DIA\VolumeSelector\VVSIT\build-VVSIT-Desktop_Qt_5_5_0_MSVC2013_32bit-Debug\UI\Makefile [debug] Error 2
21:35:43: The process "C:\ProgramFiles\Qt\Qt5.5.0\Tools\QtCreator\bin\jom.exe" exited with code 2.
Error while building/deploying project VVSIT (kit: Desktop Qt 5.5.0 MSVC2013 32bit)
When executing step "Make"
I have not modified the .pro files between one and other version of Qt. And my .pro also has the line that says:
QT += opengl
What could be wrong ?
As exposed by #Ben-Voigt in the comments above, I had to explicitly instruct Qt to link against opengl32, so I added the following in my .pro:
LIBS += -lopengl32
I'm not sure why there is a change in behaviour in Qt 5.5.0 as that line was unnecessary in previous versions, but well, it solves the problem.
I have been trying to communicate with my cassandra database with this demo code from Cassandra's cpp-driver. I am using Visual Studio Express 2013 I have been blocked with the following errors:
1>------ Build started: Project: Test_Boost, Configuration: Debug Win32 ------
1> main.cpp`
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl cql::cql_initialize(void)" (?cql_initialize#cql##YAXXZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: static class boost::shared_ptr<class cql::cql_builder_t> __cdecl cql::cql_cluster_t::builder(void)" (?builder#cql_cluster_t#cql##SA?AV?$shared_ptr#Vcql_builder_t#cql###boost##XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _sk_new_null referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::do_init(void)" (??0do_init#openssl_init_base#detail#ssl#asio#boost##QAE#XZ)
1>main.obj : error LNK2019: unresolved external symbol _sk_free referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::~do_init(void)" (??1do_init#openssl_init_base#detail#ssl#asio#boost##QAE#XZ)
1>main.obj : error LNK2019: unresolved external symbol _CRYPTO_cleanup_all_ex_data referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::~do_init(void)" (??1do_init#openssl_init_base#detail#ssl#asio#boost##QAE#XZ)
1>main.obj : error LNK2019: unresolved external symbol _CRYPTO_num_locks referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::do_init(void)" (??0do_init#openssl_init_base#detail#ssl#asio#boost##QAE#XZ)
1>main.obj : error LNK2019: unresolved external symbol _CRYPTO_set_locking_callback referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::do_init(void)" (??0do_init#openssl_init_base#detail#ssl#asio#boost##QAE#XZ)
1>main.obj : error LNK2019: unresolved external symbol _CRYPTO_set_id_callback referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::do_init(void)" (??0do_init#openssl_init_base#detail#ssl#asio#boost##QAE#XZ)
1>main.obj : error LNK2019: unresolved external symbol _CONF_modules_unload referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::~do_init(void)" (??1do_init#openssl_init_base#detail#ssl#asio#boost##QAE#XZ)
1>main.obj : error LNK2019: unresolved external symbol _OPENSSL_add_all_algorithms_noconf referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::do_init(void)" (??0do_init#openssl_init_base#detail#ssl#asio#boost##QAE#XZ)
1>main.obj : error LNK2019: unresolved external symbol _EVP_cleanup referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::~do_init(void)" (??1do_init#openssl_init_base#detail#ssl#asio#boost##QAE#XZ)
1>main.obj : error LNK2019: unresolved external symbol _SSL_load_error_strings referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::do_init(void)" (??0do_init#openssl_init_base#detail#ssl#asio#boost##QAE#XZ)
1>main.obj : error LNK2019: unresolved external symbol _SSL_library_init referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::do_init(void)" (??0do_init#openssl_init_base#detail#ssl#asio#boost##QAE#XZ)
1>main.obj : error LNK2019: unresolved external symbol _ERR_reason_error_string referenced in function "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall boost::asio::error::detail::ssl_category::message(int)const " (?message#ssl_category#detail#error#asio#boost##UBE?AV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##H#Z)
1>main.obj : error LNK2019: unresolved external symbol _ERR_free_strings referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::~do_init(void)" (??1do_init#openssl_init_base#detail#ssl#asio#boost##QAE#XZ)
1>main.obj : error LNK2019: unresolved external symbol _ERR_remove_state referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::~do_init(void)" (??1do_init#openssl_init_base#detail#ssl#asio#boost##QAE#XZ)
1>main.obj : error LNK2019: unresolved external symbol _ENGINE_cleanup referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::~do_init(void)" (??1do_init#openssl_init_base#detail#ssl#asio#boost##QAE#XZ)
1>main.obj : error LNK2019: unresolved external symbol "public: class boost::shared_ptr<class cql::cql_cluster_t> __thiscall cql::cql_builder_t::build(void)" (?build#cql_builder_t#cql##QAE?AV?$shared_ptr#Vcql_cluster_t#cql###boost##XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: class cql::cql_builder_t & __thiscall cql::cql_builder_t::add_contact_point(class boost::asio::ip::address const &)" (?add_contact_point#cql_builder_t#cql##QAEAAV12#ABVaddress#ip#asio#boost###Z) referenced in function _main
1>D:\dev\CassandraData\VisualStudio\Test_Boost\Debug\Test_Boost.exe : fatal error LNK1120: 19 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I am a complete newbie in cpp and I would appreciate any help!
Thank you!
This is the first time I have attempted to create a .dll, that will be used as a plugin to a 3rd party app.
I created a .dll project in VS210...New Project -> Win32 Console Application -> .dll + Empty Project options.
Then I added in the files I wanted to use and included the various include / dependency libs the code required. Furthermore, set the linker to include the output .lib
Configuration Properties -> Linker -> Advanced -> Import Library - $(OutDir)$(TargetName).lib
While the .lib is successfully compiled, as soon as VS tries to then build the .dll I get a load of "unresolved external symbol" errors relating to all the defined function names.
ClCompile:
SOMPlugin.cpp
Link:
Creating library F:\Data\My Documents\Visual Studio 2010\Projects\Plugin-SOM - Copy\Release\Plugin-SOM.lib and object F:\Data\My Documents\Visual Studio 2010\Projects\Plugin-SOM - Copy\Release\Plugin-SOM.exp
SOMPlugin.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall SOMPlugin::metaObject(void)const " (?metaObject#SOMPlugin##UBEPBUQMetaObject##XZ)
SOMPlugin.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall SOMPlugin::qt_metacast(char const *)" (?qt_metacast#SOMPlugin##UAEPAXPBD#Z)
SOMPlugin.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall SOMPlugin::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall#SOMPlugin##UAEHW4Call#QMetaObject##HPAPAX#Z)
SOMPlugin.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall SOMPlugin::updateView(void)" (?updateView#SOMPlugin##MAEXXZ)
SOMPlugin.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall SOMPlugin::updatedObject(int,class UpdateType const &)" (?updatedObject#SOMPlugin##MAEXHABVUpdateType###Z)
SOMPlugin.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall SOMPlugin::addToolbox(class QString,class QWidget *)" (?addToolbox#SOMPlugin##MAEXVQString##PAVQWidget###Z)
SOMPlugin.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall SOMPlugin::log(class QString)" (?log#SOMPlugin##MAEXVQString###Z)
SOMPlugin.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall SOMPlugin::log(enum Logtype,class QString)" (?log#SOMPlugin##MAEXW4Logtype##VQString###Z)
SOMPlugin.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall SOMPlugin::~SOMPlugin(void)" (??1SOMPlugin##UAE#XZ) referenced in function "public: virtual void * __thiscall SOMPlugin::`scalar deleting destructor'(unsigned int)" (??_GSOMPlugin##UAEPAXI#Z)
SOMPlugin.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const SOMPlugin::staticMetaObject" (?staticMetaObject#SOMPlugin##2UQMetaObject##B)
F:\Data\My Documents\Visual Studio 2010\Projects\Plugin-SOM\Release\Plugin-SOM.dll : fatal error LNK1120: 9 unresolved externals
Any help would be much appreciated.
The lib will be generated even if you get linker errors. Let's look at one:
SOMPlugin.obj : error LNK2001: unresolved external symbol "public:
virtual struct QMetaObject const * __thiscall
SOMPlugin::metaObject(void)const "
(?metaObject#SOMPlugin##UBEPBUQMetaObject##XZ)
This is telling you that you haven't implemented the method SOMPlugin::metaObject(void)const. Have you?
The rest are similar, other than
SOMPlugin.obj : error LNK2001: unresolved external symbol "public:
static struct QMetaObject const SOMPlugin::staticMetaObject"
(?staticMetaObject#SOMPlugin##2UQMetaObject##B)
In this case, you need a definition for the static member outside the class definition, in an implementation file.
I am trying to add a sound library to a GLFW / OpenGL project in windows. I have set the sound project to output a static library (.lib). It compiles fine.
In my main project, I add a reference to Sound and a dependency on Sound (to change the build order). I include "..\Sound\sound.h" in my main.cpp and Intellisense is happy with everything. All compiles well. However, the linker is pissed:
1>Link:
1> LINK : ###\Projects\DeathRace\Debug\DeathRace.exe not found or not built by the last incremental link; performing full link
1>Sound.lib(sound.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in base_objects.obj
1>LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alListenerfv referenced in function "public: bool __thiscall SoundAPI::Startup(void)" (?Startup#SoundAPI##QAE_NXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alListener3f referenced in function "public: bool __thiscall SoundAPI::Startup(void)" (?Startup#SoundAPI##QAE_NXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alGetError referenced in function "public: bool __thiscall SoundAPI::Startup(void)" (?Startup#SoundAPI##QAE_NXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alutGetError referenced in function "public: bool __thiscall SoundAPI::Startup(void)" (?Startup#SoundAPI##QAE_NXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alutInit referenced in function "public: bool __thiscall SoundAPI::Startup(void)" (?Startup#SoundAPI##QAE_NXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alutExit referenced in function "public: bool __thiscall SoundAPI::Shutdown(void)" (?Shutdown#SoundAPI##QAE_NXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alDeleteBuffers referenced in function "public: bool __thiscall SoundAPI::Shutdown(void)" (?Shutdown#SoundAPI##QAE_NXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alDeleteSources referenced in function "public: bool __thiscall SoundAPI::Shutdown(void)" (?Shutdown#SoundAPI##QAE_NXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alutCreateBufferFromFile referenced in function "public: unsigned int * __thiscall SoundAPI::LoadSound(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?LoadSound#SoundAPI##QAEPAIV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std###Z)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alSourcei referenced in function "public: unsigned int * __thiscall SoundAPI::CreateSource(void)" (?CreateSource#SoundAPI##QAEPAIXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alSource3f referenced in function "public: unsigned int * __thiscall SoundAPI::CreateSource(void)" (?CreateSource#SoundAPI##QAEPAIXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alSourcef referenced in function "public: unsigned int * __thiscall SoundAPI::CreateSource(void)" (?CreateSource#SoundAPI##QAEPAIXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alGenSources referenced in function "public: unsigned int * __thiscall SoundAPI::CreateSource(void)" (?CreateSource#SoundAPI##QAEPAIXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alSourceQueueBuffers referenced in function "public: bool __thiscall SoundAPI::Queue(unsigned int *,unsigned int *)" (?Queue#SoundAPI##QAE_NPAI0#Z)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alSourcePlay referenced in function "public: bool __thiscall SoundAPI::Play(unsigned int *)" (?Play#SoundAPI##QAE_NPAI#Z)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alSourcePause referenced in function "public: bool __thiscall SoundAPI::Pause(unsigned int *)" (?Pause#SoundAPI##QAE_NPAI#Z)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alSourceStop referenced in function "public: bool __thiscall SoundAPI::Stop(unsigned int *)" (?Stop#SoundAPI##QAE_NPAI#Z)
1>###\Projects\DeathRace\Debug\DeathRace.exe : fatal error LNK1120: 17 unresolved externals
I have NO IDEA what to make of this. Lnk2038 is supposed to mean a problem between debug and release, but everything is in debug mode. The lnk2019 should be fine against Sound.lib?
Much obliged!
Everything fine with your library (except you mixing debug and release runtime). You'll have to link a debug build when building a program in debug mode. Same is true for release builds. That's for error LNK2038 and warning LNK4098.
The other errors are caused by the simple fact that you can't link a static library with a static library (here: OpenAL), because that would get extra complicated if two static libraries would refer to the same static code (essentially leading to multiple definitions).
What you have to do for these errors to be solved is simple: Link your resulting executable file to your own Sound.lib as well as the right OpenAL library file and everything should be fine.