Re: Compilation of simple console application with QuantLib-vc90-mt-sgd-0_9_7.lib
Posted by
Boris Skorodumov on
Jan 13, 2009; 9:13pm
URL: http://quantlib.414.s1.nabble.com/Compilation-of-simple-console-application-with-QuantLib-vc90-mt-sgd-0-9-7-lib-tp7023p7025.html
Dear Luigi and QuantLib Users,
Thank you very much for the reply. I am very appreciate your help.
>Just checking: you're aware that QuantLib-vc90-mt-sgd-0_9_7.lib is
>compiled in debug mode and is much slower than the release version,
>right? I was not aware of it. Thank you for pointing it out. I just recompiled library in release mode (
QuantLib-vc90-mt-0_9_7.lib). It also automatically runs test suite with success.
>This is not necessary. Instead of specifying the library directly, it's
>better to add
>#include <ql/auto_link.hpp>>o one of your source files. The above will try to pull in the correct
>version of the library for your project settings, so that you won't have
l>inker errors like the ones you reported. The downside is that, if you
>want to link a specific library you compiled (such as
>QuantLib-vc90-mt-sgd-0_9_7.This is very helpful suggestion. There is small issue with
auto_link.hpp, though.
Line 63:
#define QL_LIB_NAME "QuantLib-" QL_LIB_TOOLSET QL_LIB_THREAD_OPT QL_LIB_RT_OPT "-"
QL_LIB_VERSION ".lib"QL_LIB_VERSION macro is not defined in
auto_link.hpp but in
qldefines.hpp. So, I have included also
qldefines.hpp header.
I could compile main.cpp in debug/release mode including
#include <ql/qldefines.hpp>
#include <ql/auto_link.hpp> with following configuration properties:
Debug Mode:
1. Configuration Properties->General->Additional Include Directories
C:\....\QuantLib-0.9.7 2.
Configuration Properties->Preprosessor->Preprocessor Definitions
WIN32;_DEBUG;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;
3.
Configuration Properties->Code Generation->Runtime Library
Multi-threaded Debug (/MTd)
4.
Configuration Properties->Linker->Additional Library Directories
C:\....\QuantLib-0.9.7\libRelease Mode:
1. Configuration Properties->General->Additional Include Directories
C:\....\QuantLib-0.9.7
2.
Configuration Properties->Preprosessor->Preprocessor Definitions
WIN32;_DEBUG;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;
3.
Configuration Properties->Code Generation->Runtime Library
Multi-threaded DLL (/MD)
4.
Configuration Properties->Linker->Additional Library Directories
C:\....\QuantLib-0.9.7\lib
Thank you,
Boris.
On Tue, Jan 13, 2009 at 3:57 AM, Luigi Ballabio
<[hidden email]> wrote:
Hi Boris,
On Mon, 2009-01-12 at 18:08 -0500, Boris Skorodumov wrote:
> I am a new user of QuantLib. I have compiled and run all test examples
> provided within Visual Studio 2008 with no problems.
> I would like to create simple project and link it with
> QuantLib-vc90-mt-sgd-0_9_7.lib.
Just checking: you're aware that QuantLib-vc90-mt-sgd-0_9_7.lib is
compiled in debug mode and is much slower than the release version,
right?
> I have created console application with default project settings
> except for:
>
> 4. Configuration Properties -> Linker->Input->Additional Dependencies
> QuantLib-vc90-mt-sgd-0_9_7.lib
This is not necessary. Instead of specifying the library directly, it's
better to add
#include <ql/auto_link.hpp>
to one of your source files. The above will try to pull in the correct
version of the library for your project settings, so that you won't have
linker errors like the ones you reported. The downside is that, if you
want to link a specific library you compiled (such as
QuantLib-vc90-mt-sgd-0_9_7.lib) you'll have to adjust your project
settings accordingly. In your case, I think you'll to choose debug mode
and to set Configuration Properties -> C/C++ -> Code Generation as
"Multi-threaded".
Luigi
--
I've finally learned what `upward compatible' means. It means we
get to keep all our old mistakes.
-- Dennie van Tassel
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users