I'm using the latest nightlie version (CB_20180708_rev11428_win64) and when I add a new file to the project I get the following error (a wxWidgets Debug Alert dialog is opened):
A debugging check in this application has failed. ../../src/common/strconv.cpp(2873): assert ""Assert failure"" failed in wxCSConv(): invalid encoding value in wxCSConv ctor
The file (tipically an header or a source file) is created, but Code::Blocks doesn't add it to the project tree.
the problem also existed in the previous nightlies version.
My system is 64 bit Windows 10.
Sergio
Can you post the absolute file name (path+name)?
The absolute file name is
K:\Sergio\cpp\xml\sergio\cbp5\src\cbproject.h
.The file path has no white spaces.
I don't manually wrote the file path, but I selected it browsing through the Code::Blocks GUI .
My Code::Blocks installation directory is
K:\programmi\CodeBlocks
and for the nightlie isK:\programmi\CB_20180708
.Sergio
Is there any non-ASCII character in cbproject.h? Sometimes a copy/paste from a web page or a PDF file inserts strange (and invisible) characters.
Can you attach the file?. If not, which encoding is detected if you open the file in CB editor or Notepad++? It is shown in the status bar.
The command sequence I made is:
New -> Empty file -> dialog [do you want to add new file to actice project?] -> Yes -> dialog_save_file -> browse and set a file name .
At this time codeblocks crashes and wxDebug Message appears.
The file is empty.
I restart Code::Blocks and I add the created (and empty) file to the project.
No problem to add existing file to a project (and compiling the project with GCC 5.1.0).
Now I start to write something from the CB editor (includes, defines, enums, a class skeleton, and so on) .
I know, I must use only ASCII chars in C++ headers and source file.
Notepad++ tells me that the character encoding is utf-8 without BOM.
However in Code::Blocks 17.12 this problem does not occur.
I attach that file.
Last edit: Sergio Ferrari 2018-07-11
CB 17.12 was compiled against wxWidgets 2.8.12. That version didn't use asserts like 3.1.1 does.
I don't get the assertion using your steps (my system is Windows 7 64 bits, SVN11428 with wxWidgets 3.1.1 in 32 bits).
You can use non-ASCII chars in header and source files, but some chars are illegal depending on the encoding used.
Do you see some illegal char into my file?
I never worried about character encoding when I was creating new C++ source files.
I always left to do Code::Blocks.
However, CB crashes before only one character is written in the file.
A question: where are stored settings data for CB (compilers settings, MRU, and others).
I tried to unistall CB 17.12 but this data remain stored.
I don't find in Windows 10 the
%APPDATA%
folder.Last edit: Sergio Ferrari 2018-07-12
Thank you for reporting this. Does it crash with any file? Or only with this one?
Do you have the possibility to debug codeblocks? This would be the easiest way to help us help you and codeblocks....
Is there a RPT file somewhere near codeblocks.exe?
The config file is in C:\Users\USERNAME\AppData\Roaming\CodeBlocks
Yes, CB (nightlie) crashes with any new file (I have just tried to add cbproject.cpp).
I'm an enthusiastic amateur of the C ++ language, but I have no experience in debugging.
I should read some tutorials, but I think it's not that simple.
I attach the file codeblocks.RPT
Last edit: Sergio Ferrari 2018-07-12
Which locale is active in your system?
You can check it using this guide:
Guide
Last edit: Miguel Gimenez 2018-07-12
I'm in Italy, my language is italian (obviously).
I changed the country from Italy to United States and then restarted the compuper.
I started CB and repeat the creation of a new file.
I noticed that the message reappears but, by pressing the continue button, the file is added to the project tree.
Have you tried a older (the previous) version?
It is not that hard to debug codeblocks, but it needs some time....
We need some backtrace. I tried the nightly, but it did not crash neither, so something is on your pc that is not as on our pcs...
I try to describe how you can get a backtrace:
1) Open a cmd.exe window by pressing start->typing cmd in the search and hitting enter
2) This will open the cmd window (a black window"
3) Check if gdb is in your path: type "cmd.exe" in the black window and hit enter
4) If you get the (gdb) prompt all is ok and you can go to step 7, if not:
5) Search for gdb.exe on your pc. It is installed with the compiler. I don't know how you have installed the compiler, with codeblocks or externally. The easiest way would be to search for "gdb.exe" with the file search. It should be in the "bin" sub folder of your pc. If you have found the path to gdb:
6) It is convenient to add GDB to you path for the moment: In the black window add "set PATH=%PATH%;the_path_to_gdb" Where the_path_to_gdb is the path to gdb.exe . Now try step 3 again, if it does not work close the black window and try again...
7) Close gdb by entering "q" <ENTER>
8) With the cmd go to the codeblocks folder. You can do this with "cd path_to_codeblocks" you can press the <TAB> button to complete parts of the path: type the beginning letters of the path and hit <TAB> as may times as it needs to fill the path
9) After you cd to the codeblocks exe type: "gdb.exe codeblocks.exe". This will start gdb and a "(gdb)" will appear.
10) Type "run" <ENTER> this will start codeblocks
11) Use codeblocks until it crashes
12) now you should return to the black window and the (gdb) should be there
13) type "bt all" hit enter. We need this text that is listed there... all of it...
14) To copy it go to the right top corner left click->Edit->mark now you can select the text and press <ENTER> to copy it to the clipboard...
I'm following the steps of your super-rapid tutorial:
The gdb path (
K:\programmi\MinGW\bin
) is setted on my system.From command window I type gdb and it start:
GNU gdb (GDB) 8.1
then I go to the CB directory:
cd K:\programmi\CodeBlocks
gdb tell me:
Working Directory K:\programmi\CodeBlocks
.The step 9 does not work. I type
gdb.exe codeblocks.exe <ENTER>
and the answer is:Udefined command: "gdb". Try "help"
.Last edit: Sergio Ferrari 2018-07-12
you skiped step 7)
"gdb codeblocks.exe" has to be typed in the cmd...
Anyway the backtrace is not enought... We got the backtrace from the RPT file and it gives not really a clue what is going on...
To get something usefull there are more steps to do and this are complicated... If you don't have time: Thank you anyway...
If you want to try:
1) after the crash look at the backtrace: This is a list of all function called. Lockate the first codeblocks function and switch frame to this function with "frame NR_OF_FUNCTION" where NR_OF_FUNCTION is the number near the codeblocks function in the list.
2) GDB will tell you it switched frame
3) Now enter "l" to get the line and code of where this function is called. To help us post this here...
i don't know if it is possible to generate a coredump on windows...
Last edit: bluehazzard 2018-07-12
All nightlies versions (since march) have the same problem (on my PC).
I managed to launch CB from GDB (wooow).
I copied the console output to the file I am attaching.
I hope it can be useful.
Last edit: Sergio Ferrari 2018-07-12
Which are your encoding settings (Settings->Editor->Encoding settings)?. I have ISO-8859-15, Use as default encoding selected and If conversion fails... checked.
My system is now W10 32 bits, spanish locale, SVN 11417 32 bits, and again I can't reproduce the issue.
In CB the encoding setted is
WINDOWS-1252
The radio button selected is:
as fallback encoding
andif conversion fails using...
is checked.I tried to change selecting
as default encoding...
, then restarted CB and repeated again the file creation and everything went well (the wxWidget alert no longer appeared).Well!
Last edit: Sergio Ferrari 2018-07-12
Do you have something entered in the Settings -> Editor -> Default code?
Nothing at all. Never used Default code.
This message is still appearing (see http://forums.codeblocks.org/index.php/topic,23042.msg156777.html#msg156777 )
wxCSConv doesn't like wxFONTENCODING_DEFAULT. If I change line 416 in sdk\filemanager.cpp from
to
the assert is gone. I don't understand fully this font conversions, probably wxFont::GetDefaultEncoding() returns an invalid value.
Last edit: Miguel Gimenez 2019-01-16
Miguel @ wh11204 is this still occurring with CB 20.03 32 bit on Win 10 32 bit or the nightly 64 bit builds on Win 64 bit?
Does not happen with current head (12470) on W7-32 bits with wxWidgets 3.1.5
Thanks.