Обсуждение: pgAgent 2.0.0 compilation errors (types casting)

Поиск
Список
Период
Сортировка

pgAgent 2.0.0 compilation errors (types casting)

От
"Tomasz Zeman"
Дата:
Hello,

I am using windows/visual studio 2005 to compile the pgAgent source.
There seems to be some problems with the use of wxString::wc_str.

I have compiled wxWidgets (2.8.9) with UNICODE=1 and I am still getting the error.
I am not up to date with the changes done to wxWidgets over the past 12 months.

Could somebody give me a hint what else should I correct/re-compile?

Is the pgAgent-2.0.0-Source the latest source available?

The errors are at:

win32.cpp line 59: 'wxString::wc_str' : function does not take 0 arguments
win32.cpp line 123: '_wcsdup' : cannot convert parameter 1 from 'const TCHAR *' to 'const wchar_t *'
win32.cpp line 520: 'wxString::wc_str' : function does not take 0 arguments + cannot allocate an array of constant size 0
job.cpp line 235: 'wxString::wc_str' : function does not take 0 arguments

Best regards
Tomasz Zeman

Re: pgAgent 2.0.0 compilation errors (types casting)

От
"Dave Page"
Дата:
On Sun, Nov 23, 2008 at 11:30 AM, Tomasz Zeman <tomasz.zeman@gmail.com> wrote:
> Hello,
>
> I am using windows/visual studio 2005 to compile the pgAgent source.
> There seems to be some problems with the use of wxString::wc_str.
>
> I have compiled wxWidgets (2.8.9) with UNICODE=1 and I am still getting the
> error.
> I am not up to date with the changes done to wxWidgets over the past 12
> months.

It works for me, using VC++ 2005 (the full version, not express).

> Could somebody give me a hint what else should I correct/re-compile?
>
> Is the pgAgent-2.0.0-Source the latest source available?

Yes. Are you sure you configured cmake using the mswu configuraiton
for wxWidgets? (see the wxWidgets_CONFIGURATION option).

--
Dave Page
EnterpriseDB UK:   http://www.enterprisedb.com

Re: pgAgent 2.0.0 compilation errors (types casting)

От
"Dave Page"
Дата:
Hi Tomasz

On Tue, Nov 25, 2008 at 11:02 AM, Tomasz Zeman <tomasz.zeman@gmail.com> wrote:
> Hi Dave,
>
>
> I have adjusted cmake to use the mswu and wxWidgets are compiled to use
> Unicode.
> Unfortunately, the compilation error still appears.
>
> Between other errors, I am having the following compilation ones:
> win32.cpp
> ..\win32.cpp(59) : error C2660: 'wxString::wc_str' : function does not take
> 0 arguments
> ..\win32.cpp(123) : error C2664: '_wcsdup' : cannot convert parameter 1 from
> 'const TCHAR *' to 'const wchar_t *'
>         Types pointed to are unrelated; conversion requires
> reinterpret_cast, C-style cast or function-style cast
> ..\win32.cpp(520) : error C2660: 'wxString::wc_str' : function does not take
> 0 arguments
> ..\win32.cpp(520) : error C2466: cannot allocate an array of constant size 0
>
>
> Extract from D:\C++\pgAgent-2.0.0-Source\win32.cpp (52) The compilation
> fails on the last line.
> void LogMessage(wxString msg, int level)
> {
>     if (eventHandle)
>     {
>         LPCTSTR *tmp;
>
>         tmp = (LPCTSTR *)malloc(sizeof(LPCTSTR));
>         tmp[0] = _wcsdup(msg.wc_str());
>
>
> The compiler says the wc_str expects some arguments.

That code has been like that for over 2 and a half years now, and has
been compiled countless times.

> I have inspected the wxWidget::wxString class, and there is no function
> ::wc_str without parameters.

No, but there is in include/wx/string.h (defined for Unicode builds):

const wxChar* wc_str() const { return c_str(); }

> I cannot understand how it is possible to compile this. Dave, what version
> of wx are you using?

I tested on 2.8.8 and then upgraded to 2.8.9 in case it was a version
specific issue.

Does it compile if you change the call to c_str() ?

--
Dave Page
EnterpriseDB UK:   http://www.enterprisedb.com

Re: pgAgent 2.0.0 compilation errors (types casting)

От
asifnaeem
Дата:
> ..\win32.cpp(59) : error C2660: 'wxString::wc_str' : function does not take
> 0 arguments
> ..\win32.cpp(123) : error C2664: '_wcsdup' : cannot convert parameter 1
> from
> 'const TCHAR *' to 'const wchar_t *'
>         Types pointed to are unrelated; conversion requires
> reinterpret_cast, C-style cast or function-style cast
> ..\win32.cpp(520) : error C2660: 'wxString::wc_str' : function does not
> take
> 0 arguments
> ..\win32.cpp(520) : error C2466: cannot allocate an array of constant size
> 0
>

It seems that it require /D "UNICODE". Please edit pgagent.sln and add
UNICODE or _UNICODE in the following edit box i.e.
Microsoft Visual Studio 2005 -> Configuration Properties -> c/c++ ->
Preprocessor -> Preprocessor Definitions.
Thanks.

--
View this message in context:
http://www.nabble.com/pgAgent-2.0.0-compilation-errors-%28types-casting%29-tp20645294p22139337.html
Sent from the PostgreSQL - pgadmin hackers mailing list archive at Nabble.com.