Re: Keeping STL Containers in scope in Win32 C++

Tech-Archive recommends: Fix windows errors by optimizing your registry



In article <1155094762.801589.35640@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
brianushman@xxxxxxxxx says...

[ ... ]

list<int> MyListIterator;

I haven't looked carefully at the rest of your code, but one way or
another, this looks like a problem. If you really want an iterator, you
need to do something like:

list<int>::iterator MyListIterator;

WinMain(...)
{
MyList.push_front(2);
}

WinProc(...)
{
// At this point the only integer in the list has become
unitialized, however when I view it
// in the message loop in WinMain the value is valid.
MyListIterator = MyList.begin();

Okay -- as it stands, this shouldn't compile. A few obvious things:
first of all, have you checked that the initilization code in WinMain
has actually executed _before_ you try to look at it in WndProc? Given
the asynchronous nature of WndProc's, it's easy to get things out of
order between the two.

The usual advice applies here: narrow your code down to the smallest you
can that still compiles and still shows the problem. Then cut and paste
that code into your request for help (do NOT re-type it, or we'll almost
inevitably end up with problems like above that prevent the code from
compiling).

--
Later,
Jerry.

The universe is a figment of its own imagination.
.



Relevant Pages

  • Re: Localized Parameter Directive?
    ... In fact there are 10 or 20 API declarations ... > Using RadASM which in turn is using MASM to compile. ... > invoke WinMain, hInstance,NULL,CommandLine, SW_SHOWDEFAULT ... > WinMain endp ...
    (alt.lang.asm)
  • Missing WinMain using MFC
    ... I'm now trying to compile it in WinCE with platform builder, ... The application on VisualStudio uses the MFC linked statically, ... My application does not have the WinMain function: ...
    (microsoft.public.windowsce.platbuilder)
  • Re: unresolved external symbol WinMain ??
    ... Do you have a WinMain in your code? ... usually auto-generated by eVC when you create a project. ... > I have this linker error message when a try to compile my EVC++ project. ... > Error executing bscmake.exe. ...
    (microsoft.public.windowsce.embedded.vc)
  • RE: DBD::Oracle 1.19 tests core against Oracle 10.2.0.1 - Solaris build
    ... I was able to successfully compile and link ... Seems Solaris has been a problem for a while. ... Configuring DBD::Oracle for perl 5.008008 on solaris ... Failed 13/14 tests, 7.14% okay ...
    (perl.dbi.users)
  • Re: 2.4: e100 accounting bust for multiple adapters
    ... >> Anyway the solution is simple: modular e100 is borked on 2.4, ... >haven't heard any reports of icky stats. ... Couple of compile warnings: ... I have e100-3.5.10 up now and the stats now look okay. ...
    (Linux-Kernel)