Trouble using the boost::regex library on the Windows Mobile 5.0 SDK
Hello, This is my first time posting to the boost mailing list. I certainly apologize if I am going about posting my question to the wrong way. I was just wondering if anyone has experiencing using boost with the Windows Mobile 5.0 SDK (with Visual Studio 2005). I am having some trouble getting the most basic setup to build correctly. I am simply trying to build / deploy to the WM5.0 emulator at this point. Steps that I went through: 1. Create a new "Win32 Smart Device" project for the Windows Mobile 5.0 SDK, with all default settings 2. Copy the code from the regex overview page: http://www.boost.org/libs/regex/doc/introduction.html into the main .cpp file. 3. Change all std::string to std::wstring, change all boost::regex to boost::wregex, and all "literal strings" to L"literal strings". 4. Set the "include" and "library" directories to point to the boost files 5. Initial build failed because "#error unknown CE Compiler" was tripped on line 133 of visualc.hpp. 6. I commented out the #error statement, and added the line "#define BOOST_COMPILER_VERSION 8.0" - Was this a mistake? 7. Next build, I got a fatal error: <locale>, which is #included in regex_workaround.hpp could not be found. 8. I "fixed" this by defining BOOST_NO_STD_LOCALE - because I noticed that this would cause the compiler to skip over the #include statement - Was this a mistake? 9. Now when I build I get 3 warnings on lines 52,53, and 54 of interlocked.hpp that _InterlockedIncrement, _IterlockedDecrement, and _InterlockedCompareExchange are not available as intrinsic functions. 10. I also get a number of unusual link errors: - an "unresolved external" link error for "_InterlockedDecrement" - doesn't make sense since InterlockedDecrement is a valid WinCE 5.0 function (and the correct headers and libraries are included in the build) - an "unresolved external" link error for "basic_regex< wchar_t, ." - a "machine type 'X86' conflicts with target machine type 'THUMB'" link error I am able to get around the first error by defining BOOST_USE_WINDOWS_H because I noticed that this would cause the compiler to use a different chunk of code (is this a mistake?). However, I am not certain what to do about the unresolved boost_regex, and target machine conflict errors. I believe both conflicts exist because I built the boost libraries for X86 deployment, and they do not link correctly for Win CE deployment. I built the libraries using bjam, according to this page: http://www.boost.org/more/getting_started.html. Frankly, I don't know how to build the libraries in such a way that they can target Win CE (assuming this is the issue). Alternatively, does anybody know if it is possible the use boost::regex by simply including the .h / .cpp files in the project itself, and building them along with the rest of the project? It is not clear to me if this is even possible. However, I would actually prefer this method. NOTE: Using these exact same steps I was able to build the project as a standard Win32 (that is, Non-Win CE) console project, and it ran correctly. This is true both with BOOST_NO_STD_LOCALE defined, and without it. I would appreciate any help or insight that you could provide. Thanks, Matt
Matthew Bourdua wrote:
6. I commented out the #error statement, and added the line "#define BOOST_COMPILER_VERSION 8.0" - Was this a mistake?
Nope should be OK, just means we know nothing about that platform and haven't configured for it: but you know that already :-)
7. Next build, I got a fatal error: <locale>, which is #included in regex_workaround.hpp could not be found.
8. I "fixed" this by defining BOOST_NO_STD_LOCALE - because I noticed that this would cause the compiler to skip over the #include statement - Was this a mistake?
That's fine, but you'll need to rebuild the lib with the same define set. Best to define it in boost/regex/user.hpp.
9. Now when I build I get 3 warnings on lines 52,53, and 54 of interlocked.hpp that _InterlockedIncrement, _IterlockedDecrement, and _InterlockedCompareExchange are not available as intrinsic functions.
10. I also get a number of unusual link errors:
- an "unresolved external" link error for "_InterlockedDecrement" - doesn't make sense since InterlockedDecrement is a valid WinCE 5.0 function (and the correct headers and libraries are included in the build)
- an "unresolved external" link error for "basic_regex< wchar_t, ."
- a "machine type 'X86' conflicts with target machine type 'THUMB'" link error
I am able to get around the first error by defining BOOST_USE_WINDOWS_H because I noticed that this would cause the compiler to use a different chunk of code (is this a mistake?).
Sounds correct.
However, I am not certain what to do about the unresolved boost_regex, and target machine conflict errors. I believe both conflicts exist because I built the boost libraries for X86 deployment, and they do not link correctly for Win CE deployment. I built the libraries using bjam, according to this page: http://www.boost.org/more/getting_started.html. Frankly, I don't know how to build the libraries in such a way that they can target Win CE (assuming this is the issue).
Easiest way would be to add the regex sources in libs/regex/src directly to the project. Boost.Regex is "just a bunch of sources" so you can build it any way you want. You may need to define BOOST_REGEX_NO_LIB when building to stop it from trying to automatically link to the prebuild lib files, but other than that that's it. Good luck! John.
participants (2)
-
John Maddock
-
Matthew Bourdua