Solved

Windows CE STL problems

Posted on 2003-11-29
7
501 Views
Last Modified: 2013-12-14
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
Comment
Question by:bsochan
7 Comments
 
LVL 30

Expert Comment

by:Axter
ID: 9844989
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
 

Author Comment

by:bsochan
ID: 9848884
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
 
LVL 30

Expert Comment

by:Axter
ID: 9849231
>>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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 30

Expert Comment

by:Axter
ID: 9849237
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
 

Author Comment

by:bsochan
ID: 9854830
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
 
LVL 9

Expert Comment

by:tinchos
ID: 10286250
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
 

Accepted Solution

by:
SpazMODic earned 0 total points
ID: 10347372
PAQed, with points refunded (125)

SpazMODic
EE Moderator
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question