wx3.1 linux .configure options for ToStdWString Topic is solved

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
coderrc
Earned some good credits
Earned some good credits
Posts: 141
Joined: Tue Nov 01, 2016 2:46 pm

wx3.1 linux .configure options for ToStdWString

Post by coderrc »

I am trying to get some code to compile on linux but I can't seem to get ToStdWString to compile

Code: Select all

error : ‘class wxString’ has no member named ‘ToStdWString’
my last attempt to build wxwidgets used

Code: Select all

../configure --enable-cxx11 --enable-stl --disable-shared --enable-utf8 --enable-xlocale --enable-html --with-gtk=3 --with-regex --enable-intl --enable-unicode 
I am running ubuntu 16

any help would be greatly appreciated

eta here is my command line

Code: Select all

g++ -c -x c++ /home/dev/projects/linuxscratchpad/main.cpp -I "/usr/local/include/wx-3.1" -I "/usr/local/lib/wx/include/gtk3-unicode-static-3.1/" -I /home/dev/projects/linuxscratchpad -I "/usr/include/glib-2.0" -I "/usr/lib/x86_64-linux-gnu/glib-2.0/include/" -I "/usr/local/lib/wx/include/gtk3-unicode-static-3.1" -I "/usr/local/include/wx-3.1" -g2 -gdwarf-2 -o "/home/dev/projects/linuxscratchpad/obj/x64/Debug/main.o" -Wall -Wswitch -W"no-deprecated-declarations" -W"empty-body" -Wconversion -W"return-type" -Wparentheses -W"no-format" -Wuninitialized -W"unreachable-code" -W"unused-function" -W"unused-value" -W"unused-variable" -O0 -fno-strict-aliasing -fno-omit-frame-pointer -D__WXGTK__ -D_UNICODE -D_FILE_OFFSET_BITS=64 -fthreadsafe-statics -fexceptions -frtti -std=c++11
and a sample source code

Code: Select all

#include <wx/wx.h>
#include <wx/string.h>
#include <wx/arrstr.h> 
#include <stdio.h>
#include <string>

int main()
{
	printf("hello from linuxscratchpad!\n");
	
	wxString wxteststr("this is a test");
	std::wstring test = wxteststr.ToStdWString();

	printf("done\n");
	return 0;
}
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wx3.1 linux .configure options for ToStdWString

Post by doublemax »

By default wxString uses std::[w]string internally, did you try just "std::wstring test = wxteststr;" ?
Use the source, Luke!
coderrc
Earned some good credits
Earned some good credits
Posts: 141
Joined: Tue Nov 01, 2016 2:46 pm

Re: wx3.1 linux .configure options for ToStdWString

Post by coderrc »

no. The thing is that I use wxString to convert easily between wstring, string, and char* for use with various api calls. so it isnt really just a matter of needing ToStdWstring but also ToStdString

it all seems to work fine under windows but i cant seem to find the magic bullet for linux
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wx3.1 linux .configure options for ToStdWString

Post by doublemax »

The documentation for wxString says:
If you built wxWidgets with wxUSE_STL set to 1, the implicit conversions to both narrow and wide C strings are disabled and replaced with implicit conversions to std::string and std::wstring.
Maybe try --disable-stl
Use the source, Luke!
coderrc
Earned some good credits
Earned some good credits
Posts: 141
Joined: Tue Nov 01, 2016 2:46 pm

Re: wx3.1 linux .configure options for ToStdWString

Post by coderrc »

thanks man. it looks like that did the trick. It looks like my main problem was that without intellisense to hold my hand, I typed ToStdWString instead of ToStdWstring. #-o

thanks again!
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7479
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wx3.1 linux .configure options for ToStdWString

Post by ONEEYEMAN »

In addition to what doublemax said,
Always start with just basic "../configure && make". The default configure options are enough in 99.99% of use cases.

Only if something doesn't work as expected, try to play with configure options.

Thank you.
Post Reply