Problem Compiling Quantlib addin

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem Compiling Quantlib addin

Nicola Jean
Hi everyone,
I was trying to compile the Quantlib Addin on my laptop (OS: Windows XP SP2; Visual Studio 2005 express) and i just got a funny problem:

------ Build started: Project: AddinExcelStatic, Configuration: Debug Win32 ------

Linking...

Creating library .\buildStatic\vc80\Debug/QuantLibAddinStatic-vc80-mt-sgd-0_3_12.lib and object .\buildStatic\vc80\Debug/QuantLibAddinStatic-vc80-mt-sgd-0_3_12.exp

log4cxxs-vc80-mt-sgd.lib(msxml.obj) : error LNK2019: unresolved external symbol "wchar_t * __stdcall _com_util::ConvertStringToBSTR(char const *)" (?ConvertStringToBSTR@_com_util@@YGPA_WPBD@Z) referenced in function "public: __thiscall _variant_t::_variant_t(char const *)" (??0_variant_t@@ QAE@PBD@Z)

log4cxxs-vc80-mt-sgd.lib(msxml.obj) : error LNK2019: unresolved external symbol "char * __stdcall _com_util::ConvertBSTRToString(wchar_t *)" (?ConvertBSTRToString@_com_util@@YGPADPA_W@Z) referenced in function "public: char const * __thiscall _bstr_t::Data_t::GetString(void)const " (?GetString@Data_t@_bstr_t@@QBEPBDXZ)

xll\QuantLibAddinStatic-vc80-mt-sgd-0_3_12.xll : fatal error LNK1120: 2 unresolved externals

Build log was saved at "<a href="file://c:\QuantLibAddin-0.3.12_SRC\Addins\Excel\buildStatic\vc80\Debug\BuildLog.htm">file://c:\QuantLibAddin-0.3.12_SRC\Addins\Excel\buildStatic\vc80\Debug\BuildLog.htm"

AddinExcelStatic - 3 error(s), 0 warning(s)

========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========

 it just looks like I have some problems with the linker. Having a look around on internet I found out it might be related to a problem importing a c function in a c++ project without using the 'extern "C" ' statement ( http://blogs.msdn.com/vsdteam/archive/2005/11/20/495123.aspx). Is it correct? if it is so, where do I have to modify the code? 

 

Reply | Threaded
Open this post in threaded view
|

Re: Problem Compiling Quantlib addin

jerryji
Hi Nicola,

Try this --
Setting of the project in "C/C++ -> Language -> Treat wchar_t as
Built-In Type" to "No" ( courtesy of
http://www.tek-tips.com/viewthread.cfm?qid=395540&page=7 )

Since I see no similar complaints, it could well be a VC++8 specific
issue.
--
Cheers,
Jerry

Nicola Jean wrote:
Hi everyone,
I was trying to compile the Quantlib Addin on my laptop (OS: Windows XP SP2; Visual Studio 2005 express) and i just got a funny problem:

------ Build started: Project: AddinExcelStatic, Configuration: Debug Win32 ------

Linking...

Creating library .\buildStatic\vc80\Debug/QuantLibAddinStatic-vc80-mt-sgd-0_3_12.lib and object .\buildStatic\vc80\Debug/QuantLibAddinStatic-vc80-mt-sgd-0_3_12.exp

log4cxxs-vc80-mt-sgd.lib(msxml.obj) : error LNK2019: unresolved external symbol "wchar_t * __stdcall _com_util::ConvertStringToBSTR(char const *)" (?ConvertStringToBSTR@_com_util@@YGPA_WPBD@Z) referenced in function "public: __thiscall _variant_t::_variant_t(char const *)" (??0_variant_t@@ QAE@PBD@Z)

log4cxxs-vc80-mt-sgd.lib(msxml.obj) : error LNK2019: unresolved external symbol "char * __stdcall _com_util::ConvertBSTRToString(wchar_t *)" (?ConvertBSTRToString@_com_util@@YGPADPA_W@Z) referenced in function "public: char const * __thiscall _bstr_t::Data_t::GetString(void)const " (?GetString@Data_t@_bstr_t@@QBEPBDXZ)

xll\QuantLibAddinStatic-vc80-mt-sgd-0_3_12.xll : fatal error LNK1120: 2 unresolved externals

Build log was saved at "<a moz-do-not-send="true" href="file://c:%5CQuantLibAddin-0.3.12_SRC%5CAddins%5CExcel%5CbuildStatic%5Cvc80%5CDebug%5CBuildLog.htm">file://c:\QuantLibAddin-0.3.12_SRC\Addins\Excel\buildStatic\vc80\Debug\BuildLog.htm"

AddinExcelStatic - 3 error(s), 0 warning(s)

========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========

 it just looks like I have some problems with the linker. Having a look around on internet I found out it might be related to a problem importing a c function in a c++ project without using the 'extern "C" ' statement ( http://blogs.msdn.com/vsdteam/archive/2005/11/20/495123.aspx). Is it correct? if it is so, where do I have to modify the code? 

 


RE: [Quantlib-users] log4cxx0.9.7 MS VC++8 dll project linking error resolved
Subject: RE: [Quantlib-users] log4cxx0.9.7 MS VC++8 dll project linking error resolved
From: "Jerry Jie Ji"
Date: Thu, 2 Mar 2006 14:35:10 +0800
To:

My log4cxx0.9.7 link problem was resolved by

Setting of the project in "C/C++ -> Language -> Treat wchar_t as
Built-In Type" to "No" ( courtesy of
http://www.tek-tips.com/viewthread.cfm?qid=395540&page=7 )

Since I see no similar complaints, it could well be a VC++8 specific
issue.

--
Jerry
T&O-RTT
DBS Tower 2
DID 687 85315

-----Original Message-----
From: [hidden email]
[[hidden email]] On Behalf Of Jerry
Jie Ji
Sent: Thursday, March 02, 2006 10:24 AM
To: [hidden email]
Subject: RE: [Quantlib-users] Err Msg "Not excel add-in format" for
Object Handler examples

Hi Savior, 

Sorry I know this isn't a strict QuantLib question but just hope someone
here had been through similar error.

I am stuck with the following linking error when building log4cxx0.9.7
dll project in MS Visual C++ 2005 Express Edition (the static project,
however, builds fine) --

Linking...
   Creating library ../Lib/Debug/log4cxx.lib and object
../Lib/Debug/log4cxx.exp
msxml.obj : error LNK2019: unresolved external symbol "wchar_t *
__stdcall _com_util::ConvertStringToBSTR(char const *)"
(?ConvertStringToBSTR@_com_util@@YGPA_WPBD@Z) referenced in function
"public: __thiscall _variant_t::_variant_t(char const *)"
(??0_variant_t@@QAE@PBD@Z)
msxml.obj : error LNK2019: unresolved external symbol "char * __stdcall
_com_util::ConvertBSTRToString(wchar_t *)"
(?ConvertBSTRToString@_com_util@@YGPADPA_W@Z) referenced in function
"public: char const * __thiscall _bstr_t::Data_t::GetString(void)const "
(?GetString@Data_t@_bstr_t@@QBEPBDXZ)
../Bin/Debug/log4cxx.dll : fatal error LNK1120: 2 unresolved externals

BTW, I've installed Microsoft Platform SDK for Windows Server 2003 SP1,
MSXML 3.0, MSXML 4.0 SDK SP2 but none helped.

Any help will be greatly appreciated!

--
Jerry

-----Original Message-----
From: eric ehlers [[hidden email]] 
Sent: Wednesday, March 01, 2006 5:15 PM
To: Sinha, Amitesh
Cc: Jerry Jie Ji; Liu, Xiaobo; [hidden email]
Subject: Re: [Quantlib-users] Err Msg "Not excel add-in format" for
Object Handler examples

Hi All,

To clarify:

- ObjectHandler and QuantLibAddin are supported subprojects of
QuantLib, implemented using the Excel C API (XLLs)

- Liu and Jerry are troubleshooting a QuantLibAddin error message

- Amitesh is talking about scrapping ObjectHandler and QuantLibAddin
altogether and implementing something new in a different technology
e.g. automation

Let me address these issues separately:

1) "Addin not in Excel format" error message from QuantLibAddin

On 2/28/06, Liu, Xiaobo [hidden email] wrote:
Hi,

I complied both latest versions of ObjectHandler
and QuantlibAddin, but could not load up
any *.xll files due to error msg stating that
the xll files are NOT of Excel add-in format.

On 3/1/06, Jerry Jie Ji [hidden email] wrote:
Similar problem here, just that I'm using MS VC++ 2005 Express (8)
and MS Excel (Office) 2003.

On 3/1/06, Sinha, Amitesh [hidden email] wrote:
1. http://www.planatechsolutions.com/xlpfaq/Q0011.htm
        essentially open your xll in visual studio tool "depends" and
see if any dll xll depends on is missing. I     suspect log4cxx , oh
dll
may not be in the path. If you do not have depends, go to
www.dependencywalker.com.
2. I am hoping that you are not mixing managed C++ and unmanaged C++
as
string in managed C++ are treating      differently. Most likely you
are
not doing this.
3. If point 1 does not rescue you, you may be mixing debug/release
libraries, just check that you are not doing this.

4. Using DumpBin /Exports should list the DLLs bound statically to
your
code. You need to ensure they are in your
   path, and not just lying around the target machine.

Please see also:
    http://quantlib.org/quantlibaddin/troubleshooting.html#startup_error

2) Using automation instead of the C API

On 3/1/06, Sinha, Amitesh [hidden email] wrote:
XLL technology is getting
deprecated. Most of your efforts are likely to be lost in coming
years.

For a long time it seemed evident that MS were trying to steer
developers away from the API toward newer replacements - VBA/COM/.NET.
 Many people continue to use the API because for certain tasks it is
orders of magnitude faster than the newer alternatives.  And now it
seems that MS have given up on their attempts to deprecate the API,
apparently Excel 2007 will include enhancements to the API:

http://blogs.msdn.com/excel/archive/2006/01/03/508985.aspx

Regards,
Eric




CONFIDENTIAL NOTE: The information contained in this email is intended
only for the use of the individual or entity named above and may contain
information that is privileged, confidential and exempt from disclosure
under applicable law. If the reader of this message is not the intended
recipient, you are hereby notified that any dissemination, distribution
or copying of this communication is strictly prohibited. If you have
received this message in error, please immediately notify the sender and
delete the mail.
Thank you.


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting
language
that extends applications into web and mobile media. Attend the live
webcast
and join the prime developer group breaking into this new coding
territory!
<a class="moz-txt-link-freetext" href="http://sel.as-us.falkag.net/sel?cmd=k&kid0944&bid$1720&dat1642">http://sel.as-us.falkag.net/sel?cmd=k&kid0944&bid$1720&dat1642
_______________________________________________
Quantlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users




CONFIDENTIAL NOTE: The information contained in this email is intended only for the use of the individual or entity named above and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this message in error, please immediately notify the sender and delete the mail.
Thank you.


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
<a class="moz-txt-link-freetext" href="http://sel.as-us.falkag.net/sel?cmd=k&kid0944&bid$1720&dat1642">http://sel.as-us.falkag.net/sel?cmd=k&kid0944&bid$1720&dat1642
_______________________________________________
Quantlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

Reply | Threaded
Open this post in threaded view
|

Re: Problem Compiling Quantlib addin

eric ehlers
Hi Nicola, Hi Jerry,

On my machine this works automatically with no need to change code or
project settings.  The setting

"C/C++ -> Language -> Treat wchar_t as Built-In Type"

defaults to no which corresponds to compiler flag /Zc:wchar_t- and
results in a dependency on comsupp.lib (release build) or comsuppd.lib
(debug build)

Changing the setting to yes corresponds to compiler flag /Zc:wchar_t
and results in a dependency on comsuppw.lib (release build) or
comsuppwd.lib (debug build)

I have VC Express installed on one machine and VC8 Pro installed on
another, in both cases all four flavors of the lib mentioned above
reside in folder
    "C:\Program Files\Microsoft Visual Studio 8\VC\lib"
which is specified to the compiler as "$(VCInstallDir)lib" under
    "Tools -> Options -> Projects and Solutions -> VC++ Directories ->
Library files"

Looks like your installations of VC8 differ from mine - either you
picked up a different version of VC8 or you did something different
during the installation - such that comsupp.lib/comsuppd.lib aren't
being picked up automatically.  Changing the value of the flag causes
you instead to depend on comsuppw.lib/comsuppwd.lib which for whatever
reason do get picked up automatically.  If that fix works for you I
see no harm in it, alternatively you could use the information above
to troubleshoot why the default build isn't working correctly.

Regards,
Eric