
I am using boost.python to wrap C++ function which includes directmusic libraries to simply play the midi, but lots of linkage errors "error LNK2001: unresolved external symbol". I wonder if it is possible to work with DirectX - directmusic libs. Are there any ways to wrap it? *********************compilation errors ************************* msvc.link.dll bin\msvc-7.1\debug\threading-multi\playmusic.pyd bin \msvc-7.1\debu g\threading-multi\playmusic.lib Creating library bin\msvc-7.1\debug\threading-multi\playmusic.lib and object bin\msvc-7.1\debug\threading-multi\playmusic.exp playmusic.obj : error LNK2001: unresolved external symbol _GUID_PerfMasterTempo playmusic.obj : error LNK2019: unresolved external symbol __imp__CoUninitialize@ 0 referenced in function "void __cdecl `anonymous namespace'::StartPlay(void)" ( ?StartPlay@?A0xc386fc44@@YAXXZ) playmusic.obj : error LNK2001: unresolved external symbol _CLSID_DirectMusicSegm ent playmusic.obj : error LNK2001: unresolved external symbol _IID_IDirectMusicSegme nt8 playmusic.obj : error LNK2001: unresolved external symbol _GUID_DirectMusicAllTy pes playmusic.obj : error LNK2001: unresolved external symbol _CLSID_DirectMusicPerf ormance playmusic.obj : error LNK2001: unresolved external symbol _IID_IDirectMusicPerfo rmance8 playmusic.obj : error LNK2019: unresolved external symbol __imp__CoCreateInstanc e@20 referenced in function "void __cdecl `anonymous namespace'::StartPlay(void) " (?StartPlay@?A0xc386fc44@@YAXXZ) playmusic.obj : error LNK2001: unresolved external symbol _CLSID_DirectMusicLoad er playmusic.obj : error LNK2001: unresolved external symbol _IID_IDirectMusicLoade r8 playmusic.obj : error LNK2019: unresolved external symbol __imp__CoInitialize@4 referenced in function "void __cdecl `anonymous namespace'::StartPlay(void)" (?S tartPlay@?A0xc386fc44@@YAXXZ) bin\msvc-7.1\debug\threading-multi\playmusic.pyd : fatal error LNK1120: 11 unres olved externals call "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\vcvars3 2.bat" >nul link /NOLOGO /INCREMENTAL:NO /DLL /DEBUG /subsystem:console /out:"bin \msvc-7.1\d ebug\threading-multi\playmusic.pyd" /IMPLIB:"bin\msvc-7.1\debug \threading-multi\ playmusic.lib" /LIBPATH:"C:\Panda3D-1.4.0\python\libs" @"bin \msvc-7.1\debug\th reading-multi\playmusic.pyd.rsp" if %ERRORLEVEL% NEQ 0 EXIT %ERRORLEVEL% if exist "bin\msvc-7.1\debug\threading-multi \playmusic.pyd.manifest" ( mt -nologo -manifest "bin\msvc-7.1\debug\threading-multi \playmusic.p yd.manifest" "-outputresource:bin\msvc-7.1\debug\threading-multi \playmusic.pyd;2 " ) ...failed msvc.link.dll bin\msvc-7.1\debug\threading-multi \playmusic.pyd bin\msv c-7.1\debug\threading-multi\playmusic.lib... ...removing bin\msvc-7.1\debug\threading-multi\playmusic.lib ...failed updating 2 targets... ******************************************compiliation errors************** In C++, Inside "playmusic.cpp", it needs to include following DirectMusic libs. The link errors mainly related to directmusic stuff. #include <dmusicc.h> #include <dmusici.h> #include <dmusicf.h> ************* playmusic.cpp************************* #include <boost/python/class.hpp> #include <boost/python/module.hpp> #include <boost/python/def.hpp> #include "boost/python/detail/wrap_python.hpp" //using namespace std; #include <windows.h> #include <dmusicc.h> #include <dmusici.h> #include <dmusicf.h> namespace { //----------------------------------------------------------------------------- // Defines, constants, and global variables //----------------------------------------------------------------------------- void StartPlay(); IDirectMusicLoader8* g_pLoader = NULL; IDirectMusicPerformance8* g_pPerformance = NULL; IDirectMusicSegment8* g_pSegment = NULL; FLOAT fTempo; void StartPlay() { // Initialize COM CoInitialize(NULL); // Create loader object CoCreateInstance( CLSID_DirectMusicLoader, NULL, CLSCTX_INPROC, IID_IDirectMusicLoader8, (void**)&g_pLoader ); ............. ............. namespace python = boost::python; BOOST_PYTHON_MODULE(playmusic) { python::def("StartPlay", StartPlay); } *********** playmusic.cpp*************************** The code in void StartPlay() inside "playmusic.cpp" can be compiled and executed successfully before in C++, so I extract that part. Any ideas? Thanks so much for your help --------------------------------- Yahoo! 全新升級網上相簿,讓你由相片中分享生活點滴! 立即全面試用

On 10/1/07, Elaine Wong <wongpl0503@yahoo.com.hk> wrote:
I am using boost.python to wrap C++ function which includes directmusic libraries to simply play the midi, but lots of linkage errors "error LNK2001: unresolved external symbol". I wonder if it is possible to work with DirectX - directmusic libs. Are there any ways to wrap it? *********************compilation errors *************************
[snip]
Any ideas? Thanks so much for your help
The errors you posted appear to have nothing to do with Boost. It looks like you just need to link to the correct libraries. If you have double checked and are already linking to the correct libraries, double check that the latest DirectX paths are searched first to guarantee that the linker isn't picking up previous versions of DirectX libs. HTH, --Michael Fawcett

Hi Michael Thanks for your reply. I'll double check, but I've also put those header files inside the boost folder and include as #include <boost/python/dmusicc.h>, but still failed Elaine Michael Fawcett <michael.fawcett@gmail.com> 說: On 10/1/07, Elaine Wong wrote:
I am using boost.python to wrap C++ function which includes directmusic libraries to simply play the midi, but lots of linkage errors "error LNK2001: unresolved external symbol". I wonder if it is possible to work with DirectX - directmusic libs. Are there any ways to wrap it? *********************compilation errors *************************
[snip]
Any ideas? Thanks so much for your help
The errors you posted appear to have nothing to do with Boost. It looks like you just need to link to the correct libraries. If you have double checked and are already linking to the correct libraries, double check that the latest DirectX paths are searched first to guarantee that the linker isn't picking up previous versions of DirectX libs. HTH, --Michael Fawcett _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost --------------------------------- Yahoo! 全新升級網上相簿,讓你由相片中分享生活點滴! 立即全面試用

On 10/2/07, Elaine Wong <wongpl0503@yahoo.com.hk> wrote:
Michael Fawcett <michael.fawcett@gmail.com> 說: On 10/1/07, Elaine Wong wrote:
I am using boost.python to wrap C++ function which includes directmusic libraries to simply play the midi, but lots of linkage errors "error LNK2001: unresolved external symbol". I wonder if it is possible to work with DirectX - directmusic libs. Are there any ways to wrap it? *********************compilation errors *************************
[snip]
Any ideas? Thanks so much for your help
The errors you posted appear to have nothing to do with Boost. It looks like you just need to link to the correct libraries.
If you have double checked and are already linking to the correct libraries, double check that the latest DirectX paths are searched first to guarantee that the linker isn't picking up previous versions of DirectX libs. Hi Michael
Thanks for your reply. I'll double check, but I've also put those header files inside the boost folder and include as
#include <boost/python/dmusicc.h>, but still failed
Well, I don't think header files are the problem - it's the libraries, since it's a linker error. If you have already specified in the Project Linker settings the correct libraries to link to, you need to check your library path settings in Visual Studio. Click on Tools, Options, Projects and Solutions, VC++ Directories, then Show Directories for Library files, and move the directory that contains the libs you want to link against up to the top (or at least above anywhere else older versions of the libraries could reside). You might also double check the Additional Library Directories setting in your Project Settings (if you are using it) to make sure it points to the right path. Good luck, --Michael Fawcett P.S. Please don't top post. I rearranged your post above.

Hi Michael Sorry that I'm newbie here. I follow your suggestion to move the library path at the top in visual studio project settings, but doesn't help. Under VS, there shouldn't be linkage problem as those libs can be linked and executed. Elaine Michael Fawcett <michael.fawcett@gmail.com> 說: On 10/2/07, Elaine Wong wrote:
Michael Fawcett 說: On 10/1/07, Elaine Wong wrote:
I am using boost.python to wrap C++ function which includes directmusic libraries to simply play the midi, but lots of linkage errors "error LNK2001: unresolved external symbol". I wonder if it is possible to work with DirectX - directmusic libs. Are there any ways to wrap it? *********************compilation errors *************************
[snip]
Any ideas? Thanks so much for your help
The errors you posted appear to have nothing to do with Boost. It looks like you just need to link to the correct libraries.
If you have double checked and are already linking to the correct libraries, double check that the latest DirectX paths are searched first to guarantee that the linker isn't picking up previous versions of DirectX libs. Hi Michael
Thanks for your reply. I'll double check, but I've also put those header files inside the boost folder and include as
#include , but still failed
Well, I don't think header files are the problem - it's the libraries, since it's a linker error. If you have already specified in the Project Linker settings the correct libraries to link to, you need to check your library path settings in Visual Studio. Click on Tools, Options, Projects and Solutions, VC++ Directories, then Show Directories for Library files, and move the directory that contains the libs you want to link against up to the top (or at least above anywhere else older versions of the libraries could reside). You might also double check the Additional Library Directories setting in your Project Settings (if you are using it) to make sure it points to the right path. Good luck, --Michael Fawcett P.S. Please don't top post. I rearranged your post above. _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost --------------------------------- Yahoo! 全新升級網上相簿,讓你由相片中分享生活點滴! 立即全面試用

On 10/2/07, Elaine Wong <wongpl0503@yahoo.com.hk> wrote:
Michael Fawcett <michael.fawcett@gmail.com> 說: On 10/2/07, Elaine Wong wrote:
Michael Fawcett 說: On 10/1/07, Elaine Wong wrote:
I am using boost.python to wrap C++ function which includes directmusic libraries to simply play the midi, but lots of linkage errors "error LNK2001: unresolved external symbol". I wonder if it is possible to work with DirectX - directmusic libs. Are there any ways to wrap it? *********************compilation errors *************************
[snip]
Any ideas? Thanks so much for your help
The errors you posted appear to have nothing to do with Boost. It looks like you just need to link to the correct libraries.
If you have double checked and are already linking to the correct libraries, double check that the latest DirectX paths are searched first to guarantee that the linker isn't picking up previous versions of DirectX libs. Hi Michael
Thanks for your reply. I'll double check, but I've also put those header files inside the boost folder and include as
#include , but still failed
Well, I don't think header files are the problem - it's the libraries, since it's a linker error. If you have already specified in the Project Linker settings the correct libraries to link to, you need to check your library path settings in Visual Studio.
Click on Tools, Options, Projects and Solutions, VC++ Directories, then Show Directories for Library files, and move the directory that contains the libs you want to link against up to the top (or at least above anywhere else older versions of the libraries could reside).
You might also double check the Additional Library Directories setting in your Project Settings (if you are using it) to make sure it points to the right path.
Good luck,
--Michael Fawcett
P.S. Please don't top post. I rearranged your post above.
Sorry that I'm newbie here. I follow your suggestion to move the library path at the top in visual studio project settings, but doesn't help. Under VS, there shouldn't be linkage problem as those libs can be linked and executed.
Sorry I was unable to help. Hopefully you'll have more luck in a newsgroup devoted to DirectX topics. You may want to pick the most appropriate from http://tmhare.mvps.org/help.htm#where --Michael Fawcett

Elaine Wong wrote:
The code in void StartPlay() inside "playmusic.cpp" can be compiled and executed successfully before in C++, so I extract that part. Any ideas? Thanks so much for your help
Yes, it seems the Boost headers disable auto-linking, so putting the DirectX includes before the Boost ones might help. If it doesn't just specify the libraries to link to (see Microsoft documentation) explicitly on the linker command line. Regards, Tobias
participants (3)
-
Elaine Wong
-
Michael Fawcett
-
Tobias Schwinger