|
Sometimes they all start looking the same. Glad if it helps.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Quote: the major one by Terrence Parr himself Who changes the 'damn thing' at each release in a way that irremediably invalidates the previous stuff... 
|
|
|
|
|
Hi,
I am using an MFC dialog (ANSI no Unicode) created in the resource editor with a nonlatin character name in its title, as a Property page.
While running the debug mode I can see the nonlatin title in release mode I get a gibberish characters.
What seems to be wrong here?
sdancer75
|
|
|
|
|
sdancer75 wrote: What seems to be wrong here? It is difficult to say without more information. Maybe some difference between Debug and Release settings. When you say "non Latin", what characters are you referring to?
|
|
|
|
|
Hi,
Thank you for your interest... Its the 1st time I meet this kind of problem. My Visual Studio is pretty old v2008 and the project settings are similar. Both Debug and Release share the same *.rc file.
They are both an MFC Static, not using ATL and Character Set are "not set".
My nonlatin character set is Greek. I can see the Greek titles in my dialog boxes in the editor. The only problem here is the Release version of the app. Don't know where to look for a problem.
Regards,
sdancer75
|
|
|
|
|
I think the Greek character set requires Unicode to display correctly. Try changing the settings on your project.
|
|
|
|
|
Hi,
I have used older projects with Greek characters in ANSI and code pages without problems.
Indeed unicode will solve the problem, but this specific project is too big and I have to make too many changes to finally make it work fine.
Anyway, I managed to fix the problem changing the title of the title dynamically inside the code.
Take in mind that when I recall strings from the Resource String Table using CString.LoadString(ID) I get gibberish but when I am using CStringW.LoadString(ID) it works. My String Table is not Unicode but inside VS2008 I set it up as Greek code page.
sdancer75
|
|
|
|
|
Two possible problems
1. In the project settings, make sure the character set is set to unicode for both debug and release
2. if you use third party libraries (other than MFC), make sure they also use unicode for both Debug and Release.
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
Hi,
Thanks for your reply. Indeed I am using a 3rd party library but they are all set to ANSI (no unicode at all). I fixed the problem by dynamically changing the Dialog Title.
Regards,
sdancer75
|
|
|
|
|
(the pre tag seems to be broken with the code)
const std::wstring expression( L"Value stored = $(_VARIABLE_NAME_)");
const std::wstring tmp(LR"(\$\(([^\(\)\$]*?)\))");
const std::wregex rx(tmp);
const std::wstring variableValue(L"A2347X$01GBFC");
std::match_results<std::wstring::const_iterator> matchResult;
const bool found = std::regex_search(expression, matchResult, rx);
if ( found )
{
const std::wstring expressionOut = std::regex_replace(expression, rx, variableValue, std::regex_constants::format_first_only);
std::wcout << "expressionOut = " << expressionOut << "!\n";
}
When I run the above code (or use Regex Tester )
(I added the bold)
expressionOut = Value stored = A2347X_VARIABLE_NAME_GBFC
I was expecting (or I am wanting) the result to be
expressionOut = Value stored = A2347X$01GBFC
Is there a way to treat the input "A2347X$01GBFC" as a "raw" input and not something to be parsed by the std::regex_replace ?
In our case, the string "A2347X$01GBFC" is something that a user can input manually.
I'm certain there is an way to do it, but I cannot see it.
Thanks.
I'd rather be phishing!
|
|
|
|
|
I can't see it either. It seems you've got two options, either use format_sed, if you know that you wont have \1 in the replacement string, or you'll have to turn any single $ into $$ before passing in to regex_replace There really should be a format_no_format flag to turn off format replacements.
|
|
|
|
|
Awesome! Thanks.
Will try monday.
I'd rather be phishing!
|
|
|
|
|
The format_sed option seems to work; I will make the changes and push that to the test suites.
Thanks.
I'd rather be phishing!
|
|
|
|
|
Be aware that sed_format uses "\0" to replace matches. In your case if the user input was "A2347\01GBFC", you'd get the same output as for "A2347X$01GBFC" with format_default. If that's not an issue, then you're good to go.
|
|
|
|
|
Interesting. You could drop the capture group by eliminating the parentheses before the square bracket and after the question mark.
Edit: It seems the more correct way is to create a non-capturing group by adding "?:" after the group's opening parentheses:
const std::wstring tmp(LR"(\$\((?:[^\(\)\$]*?)\))");
Added: You could also scan the input and double up any dollar signs.
modified 31-Jan-20 18:06pm.
|
|
|
|
|
Awesome! Thanks.
Will try monday.
I'd rather be phishing!
|
|
|
|
|
I have now build both project and its library using ARM architecture.
The library compiles and links - no error.
The library contains one test C++ class with only constructor / destructor implemented.
This is important to note - see the NOTEs at the end of the post.
The main program compiles but fails to link with errors indicating problem with "gcov".
The attached partial crosscompiler make output of library build indicates addition of "gcov" related options.
They have been put there as standard IDE options for building library.
I did NOT added these options.
make -j4 all
Building file: ../MODULE/M_ARM_TEST/CARMTEST.cpp
Invoking: Cross G++ Compiler
arm-linux-gnueabihf-g++ -O0 -g3 -p -pg -ftest-coverage -fprofile-arcs -Wall -c -fmessage-length=0 -v -MMD -MP -MF"MODULE/M_ARM_TEST/CARMTEST.d" -MT"MODULE/M_ARM_TEST/CARMTEST.o" -o "MODULE/M_ARM_TEST/CARMTEST.o" "../MODULE/M_ARM_TEST/CARMTEST.cpp"
Using built-in specs.
COLLECT_GCC=arm-linux-gnueabihf-g++
The attached partial output of main program posts the "gcov" errors.
lRPI_BT_LIB_ARM -lbluetooth
/media/z/DEV_COPY_LABEL/ECLIPSE_FOLDER/2019-12/Eclipse_2019_12/eclipse/Workspace_2019_12/RPI_BT_LIB_ARM/Debug/libRPI_BT_LIB_ARM.a(CARMTEST.o): In function `_GLOBAL__sub_I_65535_0__ZNSt10C_ARM_TESTC2Ev':
/media/z/DEV_COPY_LABEL/ECLIPSE_FOLDER/2019-12/Eclipse_2019_12/eclipse/Workspace_2019_12/RPI_BT_LIB_ARM/Debug/../MODULE/M_ARM_TEST/CARMTEST.cpp:42: undefined reference to `__gcov_init'
/media/z/DEV_COPY_LABEL/ECLIPSE_FOLDER/2019-12/Eclipse_2019_12/eclipse/Workspace_2019_12/RPI_BT_LIB_ARM/Debug/libRPI_BT_LIB_ARM.a(CARMTEST.o):(.data+0x28): undefined reference to `__gcov_merge_add'
collect2: error: ld returned 1 exit status
NOTE The library source code line #42 is where error is actually indicated in output , at the closing bracket of "std" namespace comment
NOTE 42 } /* namespace std */
1. What is the purpose of having -ftest-coverage -fprofile-arcs option SPECIFICALLY for library? I do not have them in any other IDE build programs.
I did not try to delete them, perhaps after I have some more knowledge about their purpose.
2. I did try to add -lgcov to program linker but it did not work.
I understand that gcov is some kind of utility tracking application and not sure why I need it.
Any help woudl be appreciated.
Cheers
|
|
|
|
|
It is not clear where that reference is coming from, but most likely in one of the header files if you did not make a specific call to it. Or did you call to some other library which in turn requires gcov? Take a look at __gcov_init - Google Search[^] for some similar issues.
|
|
|
|
|
Thanks for reply,
I did ask Mrs Google - and this is a common , used by others, way to fix the error.
# compile with coverage
CFLAGS += -g -fprofile-arcs -ftest-coverage
LDFLAGS += -lgcov
I did added -lgcov , but it did not work.
This error showed up after I added the new library which has no code , no headers, except one test class.
There are no other library referenced in this new add.
|
|
|
|
|
Vaclav_ wrote: This error showed up after I added the new library Well that should give you a clue. The only way to find out what is happening is to look into the addition that caused the message. For some reason that new library must be calling the error.
|
|
|
|
|
-lgcov is not a linker directive it's a library link and it won't work in LDFLAGS
The library links needs to go on the extreme right of the final linker call
So I am clear that is the last call that joins all the individual compiles up.
So there is exactly one line it needs to go on which is the final line executed to link
In vino veritas
|
|
|
|
|
Leon,
I got sidetracked by another issue, and this one was "FIXED" - see my next post.
From my research - it is optioned / initialized in the library I have build and I really do not understand what it supposedly doing with just the options being set. It is definitely incomplete.
I did try to delete the options, but it is "built-in".
|
|
|
|
|
SOLVED
Added --coverage to main program linker options.
From description it should make no difference if it is
complier or linker option.
Still not sure if I ever use if it supposedly created (where?) the "gconv" utility "executable" which I did not program.
|
|
|
|
|
Using the code below (called from void CLoadPngDlg::OnPaint() ) I am trying to view a PNG file that already included in the resource (IDB_FULLSCRINFOBAR_OPAQ_TEST ).
As you can see in the image attached the bottom red line and the rightmost column of pixels are not shown.
https://i.imgur.com/Ug6gYjr.jpg
Image Attached[^]
What seems to be the problem here?
BOOL CLoadPngDlg::ShowPngAt(CDC *dcWnd) {
CGdiPlusBitmapResource *pPngChannel;
UINT nWidth,nHeight;
CRect rectClient;
CBitmap Bitmap, *pOldBitmap;
CDC bitmapDC;
CDC *dialogDC;
pPngChannel = NULL;
pPngChannel = new CGdiPlusBitmapResource;
if (!pPngChannel->Load(IDB_FULLSCRINFOBAR_OPAQ_TEST, _T("PNG"))) {
delete pPngChannel;
return TRUE;
}
GetWindowRect(&rectClient);
nWidth = pPngChannel->m_pBitmap->GetWidth();
nHeight = pPngChannel->m_pBitmap->GetHeight();
bitmapDC.CreateCompatibleDC( dcWnd );
Bitmap.CreateCompatibleBitmap(dcWnd, nWidth, nHeight);
pOldBitmap = bitmapDC.SelectObject(&Bitmap);
Gdiplus::Graphics graphics(bitmapDC.GetSafeHdc());
graphics.DrawImage(*pPngChannel, 0, 0);
dcWnd->BitBlt(0, 0, rectClient.Width(), rectClient.Height(), &bitmapDC, 0, 0, SRCCOPY );
bitmapDC.SelectObject( pOldBitmap );
bitmapDC.DeleteDC();
if (pPngChannel != NULL)
delete pPngChannel;
return FALSE;
}
sdancer75
|
|
|
|
|
Where is the code for CGdiPlusBitmapResource ? I can only assume that it returns the wrong values for height and width.
|
|
|
|