Author Topic: Codeblocks Error "Failed to convert file"  (Read 16683 times)

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Codeblocks Error "Failed to convert file"
« on: June 12, 2007, 01:00:51 pm »

Hi guys !

since a long time i managed to recompile CB from SVN using the latest WX 2.8.4

but i get a lot of errors of the type

Codeblocks Error
Quote
Failed to convert file "x:\y\filename.cpp" to Unicode.

when using the Threadsearch plugin and the Codestatistics plugin
The error is showed for some files, but not for all.

where in the code is this error message emitted, i couldn't find it  :shock: anywhere
seems that i've too much distance to the CB sources  :(  atm

brgds, tiwag

Offline dje

  • Lives here!
  • ****
  • Posts: 683
Re: Codeblocks Error "Failed to convert file"
« Reply #1 on: June 12, 2007, 02:10:41 pm »
Hi !

I think this error comes from wxWidgets wxTextFile implementation but I didn't have time to check it.
wxTextFile is used both in Threadsearch and Codestatistics plugins.

Dje

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: Codeblocks Error "Failed to convert file"
« Reply #2 on: June 22, 2007, 03:31:31 pm »
thanks for your tip with wxTextFile

i've found a workaround with which it runs fine on WinXP,
just changed wxTextFile::Open() call to use "wxConvFile" parameter.

here is the patch:
Quote
Index: contrib/codestat/codestatexec.cpp
===================================================================
--- contrib/codestat/codestatexec.cpp   (revision 4152)
+++ contrib/codestat/codestatexec.cpp   (working copy)
@@ -163,7 +163,7 @@
                                  long int &comment_lines, long int &empty_lines, long int &total_lines)
 {
    wxTextFile file;
-   if (file.Open(filename.GetFullPath()))
+   if (file.Open(filename.GetFullPath(),wxConvFile))
    {
       bool multi_line_comment = false;
       total_lines += file.GetLineCount();

could some Linux dev test this please if it works with Linux too ?
thanks.


attached is the patched ThreadSearch plugin (V0.61 with wxTextFile patch)


[attachment deleted by admin]

Offline dje

  • Lives here!
  • ****
  • Posts: 683
Re: Codeblocks Error "Failed to convert file"
« Reply #3 on: June 22, 2007, 03:43:13 pm »
Hi Tiwag !

Thanks for the patch !
I'll test it this WE.

I'm about to release ThreadSearch 0.7 plugin but I have link problems on ubuntu.
I updated my Ubuntu 6.10 environment to wxWidgets 2.8.4 following cstudent wiki page.

My environment seems OK but I can't link codeblocks app because of undefined references (wxFont and others).
I have to fix that before testing on linux but I am a newbee on this OS.

Dje

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: Codeblocks Error "Failed to convert file"
« Reply #4 on: June 22, 2007, 03:54:58 pm »
@Yiannis

maybe you want to have a look at some code, where wxTextFile::Open() is used in CB sdk too.

it could happen, that there are some silent wxTextFile::Open() failures too.




[attachment deleted by admin]
« Last Edit: June 22, 2007, 03:58:56 pm by tiwag »

Offline dje

  • Lives here!
  • ****
  • Posts: 683
Re: Codeblocks Error "Failed to convert file"
« Reply #5 on: June 23, 2007, 11:37:41 pm »
Hi Tiwag !

Thanks for the patch !
I'll test it this WE.

It works on XP !
Thanks again, now I can use my plug in on C::B workspace without unicode translation errors pop-ups  :P

Still problems on linux builds.  :cry:

Dje


Offline dje

  • Lives here!
  • ****
  • Posts: 683
Re: Codeblocks Error "Failed to convert file"
« Reply #6 on: June 24, 2007, 09:15:55 pm »
I'm about to release ThreadSearch 0.7 plugin but I have link problems on ubuntu.
I updated my Ubuntu 6.10 environment to wxWidgets 2.8.4 following cstudent wiki page.

My environment seems OK but I can't link codeblocks app because of undefined references (wxFont and others).
I have to fix that before testing on linux but I am a newbee on this OS.

No more Linux build problems !
The patch works on Linux too.

Next ThreadSearch release this week  :D

Dje