Author Topic: Unable to read source file  (Read 16178 times)

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Unable to read source file
« Reply #15 on: July 23, 2018, 01:29:58 pm »
After looking future in the code i found this in
sdk\encodingdetector.cpp:137
Code
 
bool EncodingDetector::DetectEncoding(const wxString& filename, bool convert_to_wxstring)
{
[....]
   size_t readBytes = file.Read((void*)buffer, size);
    bool result = false;
    if (readBytes > 0)
        result = DetectEncoding(buffer, size, convert_to_wxstring);
Shouldn't this be
Code
 
   size_t readBytes = file.Read((void*)buffer, size);
    bool result = false;
    if (readBytes > 0)
        result = DetectEncoding(buffer, readBytes , convert_to_wxstring);
?

Anyway this does not explain why later the size is 0....
« Last Edit: July 23, 2018, 01:33:07 pm by BlueHazzard »

Offline LuiZiffer

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Unable to read source file
« Reply #16 on: July 23, 2018, 02:14:55 pm »
@BlueHazzard I did as described, the changes persist.

Offline LuiZiffer

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Unable to read source file
« Reply #17 on: July 23, 2018, 03:48:43 pm »
As requested, screenshots are attached to this post.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Unable to read source file
« Reply #18 on: July 23, 2018, 07:38:21 pm »
Ask bluehazzard mentioned the reason for the problem could be found only by making a debug and using a debugger.
My guess is that it is a combination of a cb and wx issue.
So you need to build both with debug information and do the stepping. :(
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline LuiZiffer

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Unable to read source file
« Reply #19 on: July 24, 2018, 08:31:46 am »
@omlk Here you go (it didn't change anything)
@oBFusCATed so what can/should I do now?

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Unable to read source file
« Reply #20 on: July 24, 2018, 12:14:05 pm »
Quote
@oBFusCATed so what can/should I do now?
If you ask this question then there is a lot work ahead of you. We can not do anything because we do not have the problem, and also i have not the possibility to use windows with the linux subsystem... If you are motivated enough i will try to guide you trough the steps. Be aware this is A LOT WORK/Time, but you will also learn a lot!

Quote
I just installed Code::Blocks on OpenSuse Leap 42.3 for Windows Subsystem (Windows 10 installed -> OpenSuse Sub).
I'm using wxWidgets version 3.0.4 nostl.
First i would like to know how you installed all this... Compiled by yourself? Installed from repo?

Offline LuiZiffer

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Unable to read source file
« Reply #21 on: July 25, 2018, 04:42:17 pm »
Thank you all for helping, I managed to fix the issue. I removed everything and reinstalled wxWidgets this time with the version 2.8.12 and codeblocks from the subversion repo. And somehow it works now.
Thank you @BlueHazzard for being willing to invest so much time, sadly i don't have enough myself. (If you still want to know, I installed 3.0.4 via Opensuse download website, added the rpm, then zypper and yast; I got codeblocks from a tar file, installed it via /bootstrap, /configure, etc..
And I will probably sometime in the future work on my knowledge regarding linux).
@omlk it wasn't solved, it had the same issue.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Unable to read source file
« Reply #22 on: July 25, 2018, 05:53:50 pm »
Quote
Thank you all for helping, I managed to fix the issue. I removed everything and reinstalled wxWidgets this time with the version 2.8.12 and codeblocks from the subversion repo. And somehow it works now.
Thank you @BlueHazzard for being willing to invest so much time, sadly i don't have enough myself. (If you still want to know, I installed 3.0.4 via Opensuse download website, added the rpm, then zypper and yast; I got codeblocks from a tar file, installed it via /bootstrap, /configure, etc..
Now it would be easy to help us ;)

1) Open the CodeBlocks_wx30-unix.cbp file
2) It probably will ask you about the global variable "cb_release_type" enter
Code
-g
in the base field...
3) If it did not ask about the "cb_release_type" global variable, then Settings->global variables..->Current variable->New->Name: cb_release_type->ok
3.1) proceed with step 2
4) Build->Rebuild. This will need some time...
5) Hit Alt+G and type "encodingdetector" and double click or enter the encodingdetector.cpp file
6) Git Ctrl+g and type "149" to go to line 149
7) Set a breakpoint to this line by klicking between the line number and line text until a red circle appears, or hit F5
8) Start the debugger with Debug->Start
9) A new Codeblocks (we will call it debugee from now on) will open. Open your faulty file in the debugee.
10) The codeblocks window from where you are debugging will pop up, or blink or whatever... It will display the line 149 with a yellow arrow
11) Open the watches with Debugg->Debugging windows->Watches
12) Now go back to the code and make a right click on "buffer"->Add watch
13) Now go back to the code and make a right click on "size"->Add watch
14) Now this two values will appear in the watches dialog. Please tell us the values
15) Now step trought the program and tell us what functions are called:
15.1) To step one line hit the F7 key. The yellow arrow will make a step. Please note us the path the yellow arrow makes until the end of this function....
16) If the yellow arrow is at line 247 you can abort the debugee by hiting the red button in the toolbars

Offline LuiZiffer

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Unable to read source file
« Reply #23 on: July 27, 2018, 07:27:41 pm »
i'm encountering the following error when trying to rebuild:
Quote
-------------- Build: scintilla in Code::Blocks wx3.0.x - Unix (compiler: GNU GCC Compiler)---------------
Scanned 0 files for #includes, cache used 0, cache updated 0
g++ -Wall -g -fmessage-length=0 -fexceptions -Winvalid-pch -fPIC -DcbDEBUG -DCB_PRECOMP -std=c++11 -D__WX__ -DGTK -DLINK_LEXERS -DSCI_LEXER -DWXMAKINGDLL_SCI -iquote.objs30/include -I.objs30/include -I. -Isdk/wxscintilla/include -Iinclude/tinyxml -Isdk/wxscintilla/src/scintilla/include -Isdk/wxscintilla/src/scintilla/src -Isdk/wxscintilla/src/scintilla/lexlib -c /home/luiziffer/trunk/src/sdk/wxscintilla/src/PlatWX.cpp -o .objs30/sdk/wxscintilla/src/PlatWX.o
g++ -Wall -g -fmessage-length=0 -fexceptions -Winvalid-pch -fPIC -DcbDEBUG -DCB_PRECOMP -std=c++11 -D__WX__ -DGTK -DLINK_LEXERS -DSCI_LEXER -DWXMAKINGDLL_SCI -iquote.objs30/include -I.objs30/include -I. -Isdk/wxscintilla/include -Iinclude/tinyxml -Isdk/wxscintilla/src/scintilla/include -Isdk/wxscintilla/src/scintilla/src -Isdk/wxscintilla/src/scintilla/lexlib -c /home/luiziffer/trunk/src/sdk/wxscintilla/src/scintilla/lexers/LexA68k.cxx -o .objs30/sdk/wxscintilla/src/scintilla/lexers/LexA68k.o
g++ -Wall -g -fmessage-length=0 -fexceptions -Winvalid-pch -fPIC -DcbDEBUG -DCB_PRECOMP -std=c++11 -D__WX__ -DGTK -DLINK_LEXERS -DSCI_LEXER -DWXMAKINGDLL_SCI -iquote.objs30/include -I.objs30/include -I. -Isdk/wxscintilla/include -Iinclude/tinyxml -Isdk/wxscintilla/src/scintilla/include -Isdk/wxscintilla/src/scintilla/src -Isdk/wxscintilla/src/scintilla/lexlib -c /home/luiziffer/trunk/src/sdk/wxscintilla/src/scintilla/lexers/LexAbaqus.cxx -o .objs30/sdk/wxscintilla/src/scintilla/lexers/LexAbaqus.o
g++ -Wall -g -fmessage-length=0 -fexceptions -Winvalid-pch -fPIC -DcbDEBUG -DCB_PRECOMP -std=c++11 -D__WX__ -DGTK -DLINK_LEXERS -DSCI_LEXER -DWXMAKINGDLL_SCI -iquote.objs30/include -I.objs30/include -I. -Isdk/wxscintilla/include -Iinclude/tinyxml -Isdk/wxscintilla/src/scintilla/include -Isdk/wxscintilla/src/scintilla/src -Isdk/wxscintilla/src/scintilla/lexlib -c /home/luiziffer/trunk/src/sdk/wxscintilla/src/scintilla/lexers/LexAda.cxx -o .objs30/sdk/wxscintilla/src/scintilla/lexers/LexAda.o
/home/luiziffer/trunk/src/sdk/wxscintilla/src/PlatWX.cpp:8:23: fatal error: wx/wxprec.h: No such file or directory
 #include "wx/wxprec.h"
                       ^
compilation terminated.

further infromation:
wx-config --version
returns: 2.8.12

wx-config --list
returns: Default config is gtk2-unicode-release-2.8

  Default config will be used for output

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Unable to read source file
« Reply #24 on: July 27, 2018, 10:29:16 pm »
Why are you building with 3.0 instead of 2.8 that worked for you?

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Unable to read source file
« Reply #25 on: July 28, 2018, 12:29:58 am »
Quote
Why are you building with 3.0 instead of 2.8 that worked for you?
probably to help us xD fix the bug

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Unable to read source file
« Reply #26 on: July 28, 2018, 09:48:31 am »
Quote
Why are you building with 3.0 instead of 2.8 that worked for you?
probably to help us xD fix the bug

In that case, they need to have wxWidgets 3.0 installed on the PC.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline LuiZiffer

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Unable to read source file
« Reply #27 on: July 31, 2018, 06:20:23 pm »
Quote
10) The codeblocks window from where you are debugging will pop up, or blink or whatever... It will display the line 149 with a yellow arrow
Sorry, but this doesn't happen. As in, it successfully builds and that's it. What do you mean with faulty file? (I assume you meant the project and clicked on test.cbp)
Also, I completely removed the former codeblocks to install the repo version, I still have the .tar.gz file though.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Unable to read source file
« Reply #28 on: July 31, 2018, 08:26:13 pm »
Quote
(I assume you meant the project and clicked on test.cbp)
and open the c (or cpp) file you have problems with...

Quote
As in, it successfully builds and that's it.
Does the debugee starts?

Offline LuiZiffer

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Unable to read source file
« Reply #29 on: August 01, 2018, 04:51:11 pm »
Quote
Does the debugee starts?
No, it doesn't. The window opened, i selected test.cbp, and it closed, that's it.
I'm using the WLS so I'm using Xming on windows. (Don't know if this is relevant)