How to get Eclipse CDT debugger to show contents of unicode strings? - c++

I have a C++ project that uses ICU Unicode strings heavily. Recently, I started using the Eclipse CDT IDE, but I cannot watch the contents of the strings while debugging. The only options are printing them to logs or casting them to std::string.
Does anyone know of a way to get Eclipse to show the contents of ICU strings in the "expression" view?
Update: It seems this is a known issue with Eclipse. GDB does not parse the contents of Unicode strings. It's possible to add macros/functions to enable GDB to parse them, but how can I make Eclipse use them in the "expressions" window while debugging?

Related

Unable to type #include statements properly in the latest Windows version of Geany IDE

At the time of this writing, the newest version of the Geany IDE is 1.37.1 . I came across an issue when using Geany to code in C/C++. My PC had the following configurations:
OS: Windows 10
Keyboard Layout: EN_US
Language: EN_IN
When I type #include followed by a header name such as <stdio.h>, the IDE excludes the .h extension. I checked if the Drop rest of word on completion option is turned on under Edit->Preferences->Editor->Completions. I tried including headers using both <> and "". Also, extensions such as .txt also didn't work. Re-installing the IDE didn't work for me.
For anyone having the same issue and similar keyboard configurations, I recommend removing any other existing language packs. Typing language in the search bar brings up a number of options like '''add a language to this device''' and '''Edit language and keyboard options''' etc. Selecting the latter brings up the language section in the Settings app. If you have any other pack installed other than EN_US, select the pack and remove it, only if you are sure that you are using a US keyboard. Now restart the Geany IDE and try typing #include statements once again. The above approach worked for me.

How can I make my visual studio support more unicode characters?

I have a problem with a program I made in visual studio 2019.
The code itself, or the algorithm is not wrong, because it works properly as I intended.
Yet, I got a problem, as I was adding patches to support other languages.
I added the Korean and Spanish versions, but the Korean version comes out well but the Spanish don't.
If you can see in that photo, which is the first scene of my program, the English and Korean characters' outputs are fine but for Spanish, it is printed as "Espa?ol", which is supposed to be printed as "Español".
I believe this is some presets problem or lack of language packs (which are related to Unicode systems) or so but I couldn't find anything to fix this problem.
How can I fix this problem and let the Spanish characters appear properly?
For your information, I am using C++ in VS2019 and used the "string" type for all statements.
I am requesting your help to fix this problem.
Thank you for your generosity.
It seems you need two things:
Setting execution character set for your VC++ project.
https://learn.microsoft.com/en-us/cpp/build/reference/execution-charset-set-execution-character-set?view=vs-2019
Basically adding compiler option /utf-8 to Configuration Properties, C/C++, Command Line.
Changing the code page for the console. Visual Studio use cmd for console application, and cmd may not handle Unicode character properly.
You can execute your .exe program from an independent cmd instead, using an Unicode code page:
cmd>chcp 65001
cmd>out.exe
Hello Español!
Or calling the chcp command from inside your program.
system("chcp 65001");
cout << "Hello Español!" << endl;

MySQL with C++ program

I need to write a C++ Windows App to fetch data from a text file stored in a web site (http:.../my.txt) and contains data as follows :
m[mi++]="16.11.12 11:35:00|3366;3448;5352;431|3426;3508;5421;438|3396;3480;5364;443|3515;3598;5560;437|3622;3704;5741;472|3483;3561;5193;442|3454;3536;5464;440|3748;3835;5527;474|3385;3469;5367;436|3326;3413;4800;701;24|8092;8274;12800;688;30"
m[mi++]="19.12.12 11:35:00|3366;3448;5352;431|3426;3508;5421;438|3396;3480;5364;443|3515;3598;5560;437|3622;3704;5741;472|3483;3561;5193;442|3454;3536;5464;440|3748;3835;5527;474|3385;3469;5367;436|3326;3413;4800;701;24|8092;8274;12800;688;30"
I need to read the first 2 inputs of data (start with m[mi++]) each 2 minutes and take the first two parameters from each ones and store it in mySQL table as a script file as follows
Date Data
16.11.12 11:35:00 3366;3448;5352;431
19.12.12 11:35:00 3366;3448;5352;431
Which C++ IDE (not MS visual studio) that is good to use with MySQL without any complication. I tried Netbeans and Eclipse but I've got errors with both MinG and Cygwin
Actually, its not about IDE. Everyting should work almost everywhere (if you have up to date compiller and set things up correctly). I personally use MSVS and mysql++ library. Everything work just fine.
There is no such a thing as IDE for C++ and MySQL development. Just use IDE you want and add libraries correctly. You didnt wrote, what library are you using, so I cant help you more.
I would say that CodeLite (codelite.org) or Code::Blocks (codeblocks.org are decent alternatives. You might need to Checkout wxDevCpp (DevCpp is dead), Anjuta, KDevelop, QT Creator and more.
I personally find MSVS a complicated IDE also I personally believe Eclipse and Netbeans should be used in Java (they Work with C++ both with right plugins)
My personal vote to CodeLite

Can I use Eclipse CDT to debug a prebuilt C++ executable?

On Linux, I have some C++ programs built with my own makefiles, and I'm looking for some GUI debuggers to debug them at source level.
Previously I use KDbg(2.5.2) on openSUSE(12.3). It works but with some very annoying limitation, e.g., I cannot set a breakpoint when the debugged program is not trapped by Kdbg -- I mean, in order to set a new breakpoint, I have to set it before the program is launched or the program pauses on hitting an already set breakpoint.
Now I try to use Eclipse CDT. I got eclipse-cpp-juno-SR2-linux-gtk.tar.gz but find that I don't know how to load my executable so to start debugging.
I googled with words like 『eclipse debug pre-built C binary』, but few seems to care about this feature.
Can Eclipse CDT really do that? If Eclipse CDT can't, is there any better alternatives to KDbg? Please help.
According to hint from this answer, https://stackoverflow.com/a/248119/151453 , I finally figure out how to do it.
The key point is: In the Eclipse CDT project, create/edit a Launch Configuration so to tell the debugger what executable to load.
Now I have to admit, Eclipse CDT does quite well in C++ code debugging far better than KDbg.
Some screen shot below, on openSUSE 12.3 .
Now we can Run -> Debug (F11)
Debugger automatically pauses the program at main()'s first statement.
The Stand-alone Debugger is an Eclipse application which packages the Eclipse plug-ins from the CDT (C/C++ Development Tools) project into an application that can be started from a command-line script:
bash /path/scripts/cdtdebug.sh -e executable [args]

Problem with Unicode in C++ exe (MSVC++2010)

I have a strange problem which I don't know where it came from. I might have changed some settings in the MSVC++2010 project but it all looks good to me.
I'm currently experimenting with the VSHADOW.EXE 3.0 tool included with Windows SDK 6.1. This is a sort of backup program written in C++ and the strings in it are composed of wchar_ts. Now, my arguments (such as -q) which I pass to the program always result in strings of japanese symbols in the program. This occurs if I start the program normally via cmd, but also if I specify commandline arguments in the Visual Studio project settings and start the debugger.
Does someone have an idea how to solve this problem? Thanks!
Problem solved, I changed wmain to main for a test and forgot to change it back.