conversion warnings on build

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

conversion warnings on build

David Schwartz-8
I successfully built Bermuda option project which
includes date.cpp and date.hpp without warnings.  When
I include date.* in my own dll project, I get the
following type of warnings:

date.hpp(x) : warning C4267: 'return' : conversion
from 'size_t' to 'QuantLib::Day', possible loss of
data

lines x-1 and x:
1) inline Day Date::dayOfMonth() const {
        return dayOfYear() -
monthOffset(month(),isLeap(year()));
    }
2) inline Day Date::dayOfYear() const {
        return serialNumber_ - yearOffset(year());
    }


my dll is a test dll that defines:

Date DLLEXP myDate(Day d, Month m, Year y)
{return Date(d, m, y);};

and compiles without warning.

It also errors with:

LINK : fatal error LNK1104: cannot open file
'QuantLib_d.lib'

Any suggestions would be appreciated.

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


Reply | Threaded
Open this post in threaded view
|

Re: conversion warnings on build

Ferdinando Ametrano-3
Hi David

>date.hpp(x) : warning C4267: 'return' : conversion
>from 'size_t' to 'QuantLib::Day', possible loss of
>data

QuantLib::Day is a typedef to int, while size_t is unsigned int. We should
pay some attention, but I won't fix it immediately, since date algebra may
require (negative) int somewhere.
No real problem here: just ignore the warning


>It also errors with:
>
>LINK : fatal error LNK1104: cannot open file
>'QuantLib_d.lib'

QuantLib_d.lib is the debug version of the library: you've probably
built/installed only the release version QuantLib.lib while you're
compiling the Debug version of your dll, which require QuantLib_d

hope it helps


------------
ciao -- Nando