x
This website is using cookies. We use cookies to ensure that we give you the best experience on our website. More info. That's Fine
HPC:Factor Logo 
 
Latest Forum Activity

Using VS Code for Windows CE C++ dev

Karpour Page Icon Posted 2021-04-06 2:03 AM
#
Avatar image of Karpour
Subscribers
H/PC Philosopher

Posts:
310
Location:
Austria
Status:
I've long wondered whether this was practical, but it turns out, it's very much possible

Here's what I did:
- Set up standard Win2k install in Virtualbox
- Install embedded Visual C++
- Add shared Projects Folder between host and VM
- Install old version of cygwin + openssh in VM
- Add SSH port forwarding
- Copy header files from Win2k machine to some folder on my host
- Create new VSCode workspace, add headerfiles in the config, set c++ standard to C++98, add some defines needed for CE

voila! I can now write code with all the conveniences of Intellisense and code checking in VS Code, while the compiler and all other CE-related tools happily run inside the VM





(Capture.PNG)



Attachments
----------------
Attachments Capture.PNG (348KB - 0 downloads)
 Top of the page
ntware Page Icon Posted 2021-04-06 2:45 AM
#
Avatar image of ntware
Subscribers
H/PC Elite

Posts:
554
Location:
Florida, US
Status:
This is REALLY cool! Could you be more descriptive about which header files you copied from the W2K VM and how you setup your workspace in VSCode? I've always wanted to build a port of some modern VNC client app for WinCE but was afraid of doing it in 2021 with no documentation available on the interwebs. Now with intellisense things get a lot better!
 Top of the page
C:Amie Page Icon Posted 2021-04-06 9:45 AM
#
Avatar image of C:Amie
Administrator
H/PC Oracle

Posts:
15,648
Location:
United Kingdom
Status:
Karpour,

I'd definitely love to publish a full how-to guide on this if you'd be willing to write it?
 Top of the page
Karpour Page Icon Posted 2021-04-06 3:50 PM
#
Avatar image of Karpour
Subscribers
H/PC Philosopher

Posts:
310
Location:
Austria
Status:
Yup, I'm all for it!

It'll be for Virtualbox though since I couldn't make Hyper-V do all the things I wanted easily. Advantage is that the setup will work both on Windows and Linux that way! I'll try to write something up soon!
 Top of the page
Karpour Page Icon Posted 2021-04-06 11:58 PM
#
Avatar image of Karpour
Subscribers
H/PC Philosopher

Posts:
310
Location:
Austria
Status:
Whew, still somewhat messy, but I managed to got most errors figured out. It seems a lot of files are always included by default, so to make sure you don't get lots of errors when opening windows ce .h files for reference, I created a separate VS Code config for the includes folder:

{ 
    "configurations": [ 
        { 
            "name": "WinCE 2.11 ARM", 
            "forcedInclude": [ 
                "${workspaceFolder}/windef.h", 
                "${workspaceFolder}/types.h", 
                "${workspaceFolder}/wtypes.h", 
                "${workspaceFolder}/winnt.h", 
                "${workspaceFolder}/windows.h", 
                "${workspaceFolder}/ocidl.h", 
                "${workspaceFolder}/replfilt.h", 
                "${workspaceFolder}/ipexport.h", 
                "${workspaceFolder}/mmreg.h", 
                "${workspaceFolder}/stdlib.h", 
                "${workspaceFolder}/msgstor2.h" 
            ], 
            "defines": [ 
                "${default}", 
                "UNDER_CE", 
                "_X86_", 
                "_WCHAR_T_DEFINED" 
            ], 
            "intelliSenseMode": "windows-msvc-x86", 
            "cppStandard": "c++98", 
            "cStandard": "c99" 
        } 
    ], 
    "version": 4 
}


It works great! As someone who has never done much with the regular windows API, it makes things 100x easier when I can quickly follow references, get to the root of typedefs and have fancy autocomplete features
 Top of the page
stingraze Page Icon Posted 2021-04-08 6:28 AM
#
Avatar image of stingraze
Writing Team
H/PC Vanguard

Posts:
2,664
Location:
Japan
Status:
Great work!
So, this means that you're offloading compilation on Windows 2000? sweet.

Edited by stingraze 2021-04-08 6:29 AM
 Top of the page
Karpour Page Icon Posted 2021-04-08 10:43 PM
#
Avatar image of Karpour
Subscribers
H/PC Philosopher

Posts:
310
Location:
Austria
Status:
Yeah I did, I figured it wasn't worth trying to go through the headache of trying to get eVC + all the tools work on Windows 10.
Sadly eVC does not - as far as I know - provide and CLI options for building a project, otherwise I could integrate it into VS Code. If anyone has ideas on how I could build from CLI, suggestions are welcome.


I ran into some issues where after running autoformat in VSCode, eVC++ gives me loads of errors when compiling, no idea what's up. It replaces tabs with spaces, which should be fine.. Maybe it does something to the line breaks.. No idea, I'll have to try around
 Top of the page
Karpour Page Icon Posted 2021-04-08 11:01 PM
#
Avatar image of Karpour
Subscribers
H/PC Philosopher

Posts:
310
Location:
Austria
Status:
Mystery solved, clangformat somehow took the liberty to re-order the includes. I turned it off and it works fine now
 Top of the page
C:Amie Page Icon Posted 2021-04-09 10:49 AM
#
Avatar image of C:Amie
Administrator
H/PC Oracle

Posts:
15,648
Location:
United Kingdom
Status:
Do you think this could be bundled into a VS Code extension? We could GitHub it, perhaps encourage some more development.

I imagine that clxxx.exe do support command line parameters, but I doubt they are documented. Process tracing during a compile will probably reveal all.

These are the CE 2.11 options for clarm.exe

Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8274.0     for ARM 
Copyright (C) Microsoft Corp 1984-1998. All rights reserved. 
 
                          C/C++ COMPILER OPTIONS 
 
                              -OPTIMIZATION- 
 
/O1 minimize space                       /Oi enable intrinsic functions 
/O2 maximize speed                       /Op[-] improve floating-pt consistency 
/Oa assume no aliasing                   /Os favor code space 
/Ob<n> inline expansion (default n=0)    /Ot favor code speed 
/Od disable optimizations (default)      /Ow assume cross-function aliasing 
/Og enable global optimization           /Ox maximum opts. (/Ogitb1 /Gs) 
 
                             -CODE GENERATION- 
 
/Gf enable string pooling                /QRarch4 ARM4 Architecture (no Thumb) 
/GF enable read-only string pooling      /QRarch4T ARM4T Architecture (Thumb) 
/Gy separate functions for linker        /QRinterwork-return ARM<-->Thumb calls 
 
                              -OUTPUT FILES- 
 
/Fa[file] name assembly listing file     /Fo<file> name object file 
/FA[sc] configure assembly listing       /Fp<file> name precompiled header file 
/Fd[file] name .PDB file                 /Fr[file] name source browser file 
/Fe<file> name executable file           /FR[file] name extended .SBR file 
/Fm[file] name map file 
(press <return> to continue) 
 
                              -PREPROCESSOR- 
 
/C don't strip comments                  /FI<file> name forced include file 
/D<name>{=|#}<text> define macro         /U<name> remove predefined macro 
/E preprocess to stdout                  /u remove all predefined macros 
/EP preprocess to stdout, no #line       /I<dir> add to include search path 
/P preprocess to file                    /X ignore "standard places" 
 
                                -LANGUAGE- 
 
/Zi enable debugging information         /Zl omit default library name in .OBJ 
/Z7 enable old-style debug info          /Zg generate function prototypes 
/Zd line number debugging info only      /Zs syntax check only 
/Zp[n] pack structs on n-byte boundary   /vd{0|1} disable/enable vtordisp 
/Za disable extensions (implies /Op)     /vm<x> type of pointers to members 
/Ze enable extensions (default)          /noBool disable "bool" keyword 
 
                              -MISCELLANEOUS- 
 
/?, /help print this help message        /V<string> set version string 
/c compile only, no link                 /w disable all warnings 
/H<num> max external name length         /W<n> set warning level (default n=1) 
/J default char type is unsigned         /WX treat warnings as errors 
(press <return> to continue) 
/nologo suppress copyright message       /Yc[file] create .PCH file 
/Tc<source file> compile file as .c      /Yd put debug info in every .OBJ 
/Tp<source file> compile file as .cpp    /Yu[file] use .PCH file 
/TC compile all files as .c              /YX[file] automatic .PCH 
/TP compile all files as .cpp            /Zm<n> max memory alloc (% of default) 
 
                                 -LINKING- 
 
/MC link with COREDLL.LIB, CORELIBC.LIB  /LDd Create .DLL debug libary 
/ML link with COREDLL.LIB, LIBC.LIB      /F<num> set stack size 
/LD Create .DLL                          /link [linker options and libraries] 
 
                      -NOT SUPPORTED IN THIS RELEASE- 
 
/Gd __cdecl calling convention           /Gi[-] enable incremental compilation 
/Gr __fastcall calling convention        /Gm[-] enable minimal rebuild 
/Gz __stdcall calling convention         /EHs enable synchronous C++ EH 
/GA optimize for Windows Application     /EHa enable asynchronous C++ EH 
/GD optimize for Windows DLL             /EHc extern "C" defaults to nothrow 
/GZ enable runtime debug checks          /ZI enable Edit & Continue debug info 
/Ge force stack checking for all funcs   /MD link with MSVCRT.LIB 
/Gs[num] disable stack checking calls    /MT link with LIBCMT.LIB 
/Gh enable hook function call            /MDd link with MSVCRTD.LIB debug lib 
/GR[-] enable C++ RTTI                   /MLd link with LIBCD.LIB debug lib 
(press <return> to continue) 
/GX[-] enable C++ EH (same as /EHsc)     /MTd link with LIBCMTD.LIB debug lib 
 Top of the page
Karpour Page Icon Posted 2021-04-09 11:31 AM
#
Avatar image of Karpour
Subscribers
H/PC Philosopher

Posts:
310
Location:
Austria
Status:
cl.exe might work, but there's all these steps in the build process that are done by eVC++ (auto-generating header files, resource files, etc) that would have to be replicated so things properly work.
Might be something to look into at some point, but right now I'm mostly trying to find a setup that works

If there's anyone with more knowledge about eVC++ who wants to work on putting something a little more advanced together, I'm up for it!
 Top of the page
hpc:factor« View previous thread · Developers Arena · View next thread »
Jump to forum:
Seconds to generate: 0.125 - Cached queries : 67 - Executed queries : 9
Server Time now is: Sunday, 18 April 2021 - 12:21