none
iostream on WinCE 6.0 R3 RRS feed

  • Question

  • I created a new 'Platform Builder for CE 6.0' project, with the 'OS Design' Visual Studio installed template. I have used the "Device Emulator: ARMV4I" BSP, 'Industrial Device' Design Template, 'Industrial Controller' Design Template Variant, with the default config.

    I created a new sub-project ( WCE Console Application ) ---> Simple Embedded Windows CE application

    The cpp file has the following source

    #include "stdafx.h"
    #include <iostream>
    using namespace std;

    int _tmain(int argc, TCHAR *argv[], TCHAR *envp[])
    {
        cout << "Hello World!" << endl;
        return 0;
    }

    On building the sub-project I get the following error

    : fatal error C1083: Cannot open include file: 'iostream': No such file or directory

     

    My objective is to be able to use the BOOST unit test framework for my testing application. The BOOST unit test framework needs iostream. Doesn't WinCE support the iostream? What do I need to do to have iostream support?

     

    • Moved by Jesse Jiang Tuesday, May 31, 2011 8:32 AM (From:Visual Studio Smart Device Development - Native C++ Project)
    Thursday, May 19, 2011 2:41 PM

All replies

  • Yes, iostream works in Windows Mobile. Can you verify you have $(VCInstallDir)\ce\include in your Visual Studio Include directories for your platform?

    The boost unit test framework requires parts of the C++ standard library that aren't included in the Windows Mobile version. Specifically getenv() and strerror(). strerror you can implement yourself using FormatErrorW(), but getenv will be more challenging as Windows Mobile doesn't have the concept of environment variables.

    If you do get boost.Test to work, I would be interested in your changes. Please, post back with an update. I have a short discussion on the boost-users group on this topic you can read, if you're interested. https://groups.google.com/forum/#!msg/boost-list/iSo7y05s1uY/7TtD_807KcgJ

     

    Thanks,

    PaulH


    • Proposed as answer by Jesse Jiang Tuesday, May 24, 2011 5:53 AM
    Friday, May 20, 2011 1:31 PM
  • Hi PaulH

    $(VCInstallDir)\ce\include is in the Visual Studio Include directories for my platform. I also used the include path for my sub-project. However as there was space in the path specified it wouldn't consider the path. I resolved this by reinstalling MS VS2005 such that there are no spaces in the path

    On attempting to build the sub-project I now got a different set of warnings & errors as given below

    BUILD: [01:0000000027:PROGC ] Compiling .\Subproject1.cpp
    BUILD: [01:0000000030:WARNN ] D:\MSVS2005\VC\ce\include\ostream(664) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
    BUILD: [01:0000000031:WARNN ] D:\MSVS2005\VC\ce\include\istream(940) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
    BUILD: [01:0000000032:WARNN ] D:\MSVS2005\VC\ce\include\istream(1174) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
    BUILD: [01:0000000033:WARNN ] D:\MSVS2005\VC\ce\include\ostream(568) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
    BUILD: [01:0000000046:WARNN ] D:\MSVS2005\VC\ce\include\ostream(568) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
    BUILD: [01:0000000059:WARNN ] D:\MSVS2005\VC\ce\include\ostream(140) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
    BUILD: [01:0000000066:WARNN ] D:\MSVS2005\VC\ce\include\istream(116) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
    BUILD: [01:0000000079:WARNN ] D:\MSVS2005\VC\ce\include\istream(116) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
    BUILD: [01:0000000092:WARNN ] D:\MSVS2005\VC\ce\include\ostream(140) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
    BUILD: [01:0000000099:WARNN ] D:\MSVS2005\VC\ce\include\xstring(1981) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
    BUILD: [01:0000000114:WARNN ] D:\MSVS2005\VC\ce\include\ostream(822) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
    BUILD: [00:0000000125:PROGC ] Building LINK Pass in D:\WINCE600\OSDesigns\ArmSim\ArmSim\Subproject1\ directory.
    BUILD: [01:0000000141:PROGC ] Linking obj\ARMV4I\debug\Subproject1.exe
    BUILD: [01:0000000158:ERRORE] Subproject1.obj : error LNK2001: unresolved external symbol "class std::basic_ostream<char,struct std::char_traits<char> > std::cout" (?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A)
    BUILD: [01:0000000159:ERRORE] Subproject1.obj : error LNK2019: unresolved external symbol "public: static void __cdecl std::_String_base::_Xran(void)" (?_Xran@_String_base@std@@SAXXZ) referenced in function "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __cdecl std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::assign(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned int,unsigned int)" (?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAAAAV12@ABV12@II@Z)
    BUILD: [01:0000000160:ERRORE] Subproject1.obj : error LNK2019: unresolved external symbol "public: static void __cdecl std::_String_base::_Xlen(void)" (?_Xlen@_String_base@std@@SAXXZ) referenced in function "protected: bool __cdecl std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Grow(unsigned int,bool)" (?_Grow@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IAA_NI_N@Z)
    BUILD: [01:0000000161:ERRORE] Subproject1.obj : error LNK2019: unresolved external symbol "public: void __cdecl std::_Mutex::_Lock(void)" (?_Lock@_Mutex@std@@QAAXXZ) referenced in function "public: void __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::_Lock(void)" (?_Lock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAAXXZ)
    BUILD: [01:0000000162:ERRORE] Subproject1.obj : error LNK2019: unresolved external symbol "public: void __cdecl std::_Mutex::_Unlock(void)" (?_Unlock@_Mutex@std@@QAAXXZ) referenced in function "public: void __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::_Unlock(void)" (?_Unlock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAAXXZ)
    BUILD: [01:0000000163:ERRORE] obj\ARMV4I\debug\Subproject1.exe : fatal error LNK1120: 5 unresolved externals

     

    Is there any other library I need to include?

    Thanks Will

    Friday, May 27, 2011 12:53 PM
  • You should turn on C++ exceptions in your linker settings as the linker warnings suggest.

    In your your library directories, verify $(VCInstallDir)ce\lib\ARMV4I is specified.

    -PaulH

    • Proposed as answer by Jesse Jiang Monday, May 30, 2011 8:24 AM
    Friday, May 27, 2011 1:17 PM
  • I have $(VCInstallDir)ce\lib\ARMV4I in the libraries path

    comsuppw.lib, comsuppwd.lib, libcmt.lib, libcmtd.lib, libcpmt.lib, libcpmtd.lib, msvcrt.lib, msvcrtd.lib are the .lib files present in $(VCInstallDir)ce\lib\ARMV4I

    I don't think any of these has the required definintions.

    Is there a particular .lib file that needs to be linked?

    Tuesday, May 31, 2011 6:41 AM
  • Hi ,

     

    I think your issue should be raised in the Windows Embedded Compact Platform Development. I believe they will know more information of this issue than us, and I will move this one to that forum.

     

    Thanks for your understanding,

     

    Best regards,

    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, May 31, 2011 8:31 AM
  • Hi Freewilled,

    Have you been able to successfully port Boost to WinCE?

    Thanks,

    Sam

    Thursday, November 17, 2011 10:40 PM