[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 546
  • Last Modified:

Windows CE STL problems

I have read that windows CE supports the STL library however when I attempt to use components from the STL library such as

<map> or <vector> I get the following error

c:\program files\windows ce tools\wce420\pocket pc 2003\include\armv4\xmemory(46) : error C2660: 'new' : function does not take 2 parameters
        c:\program files\windows ce tools\wce420\pocket pc 2003\include\armv4\xmemory(78) : see reference to function template instantiation 'void __cdecl std::_Construct(unsigned int *,const unsigned int &)' being compiled

I have tried starting new projects and just adding in the header files and assigning some memory to a std::map but it still gives me that error.

I have also tried switching from debug to release version of the compiler and I still recieve the same error.

The only time I have been able to get rid of the error is to turn off precompiled headers and move the include declaration for <map> or <vector> above that of the "stdafx.h".

The development environment being used for this is the embedded c++ 4 with service pack 2 and the SDK for pocket pc 2003 installed.

Any help on this problem would be apprecaiated.
0
bsochan
Asked:
bsochan
1 Solution
 
AxterCommented:
It sounds like the #include's are listed in the wrong order.

Please post all the #include's you have for the implementation that's giving you the error.

Also give information on any #include directives that you have in your project's header files.
0
 
bsochanAuthor Commented:
An example would be

in the file

programfiledlg.cpp the includes would be as follows. It is setup as the headers would be in a new project that has just been started.

#include "stdafx.h"

#include "programfiledlg.h"

..... program code follows

the header file would have something like

#include <map>
#include <vector>
#include <string>

this is then followed by any header files that are then needed from with the projects existing structure.
0
 
AxterCommented:
>>this is then followed by any header files that are then needed from with the projects existing structure.

Can you post the header files listed in the project header files?

More then likely, there are header files in the project header files that are creating the conflict.

This is one of the reasons header files should only have the bare minimum #include directives.

The problem is probably nested in one of your #include's of #include's
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
AxterCommented:
Do you have "using namespace std" in any of your header files?
This could also cause problems if non-standard headers are mixed with standard headers.
0
 
bsochanAuthor Commented:
We have actually managed to work out the solution to the problem it was related to a conflict with multithreading in the CE environment.

The solution we found was to do the following

#undef _MT
#include <map>
#define _MT

this can be done within the stdafx.h at the bottom or in the header file in which the parts of the code are being used.

Thanks for all the help that people have offered.
0
 
tinchosCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

PAQ with points refunded

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Tinchos
EE Cleanup Volunteer
0
 
SpazMODicCommented:
PAQed, with points refunded (125)

SpazMODic
EE Moderator
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now