Thread: RE: [Dev-C++] stl and windows apps
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: James G. <Jam...@Cl...> - 2001-03-28 13:21:21
|
I assume that you have included the line 'including namespace std;' or
'including std::list;' in there?
Regards,
James.
-----Original Message-----
From: Richard Asbury [mailto:dic...@ho...]
Sent: Monday, March 26, 2001 2:30 AM
To: dev...@li...
Subject: [Dev-C++] stl and windows apps
posted this on the forum but hoping that more people will read it here...
i've had some real problems using the stl in programs compiled for windows
(i.e. no console)... vector::push_back, the string constructor and the list
constructor will all cause runtime errors...
does anyone know how to sort this out, or am i going to have to write my own
stl?
here's an example of some code that will die
#include <list>
#include "windows.h"
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
list<int> li;
return 0;
}
thanks in advance,
richard
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
This electronic message and any attachment is intended to be
read by the named addressee(s) only.
Any other recipient should be aware that its contents may be
legally privileged and/or confidential and that its use,
disclosure, copying or distribution may be unlawful.
Unless you are a named addressee, please delete this message
Whilst C. & J. Clark International Limited has taken steps
to prevent the transmission of computer viruses with electronic mail,
responsibility for screening incoming messages and the risk of such
transmission and its consequences lies with the recipient.
C. & J. Clark International Limited
Registered in England and Wales
Company No. 141015
Registered Office: 40 High Street, Street, Somerset BA16 0YA
Telephone: +44 (0) 1458 443131
Fax: +44 (0) 1458 447547
|
|
From: Richard A. <dic...@ho...> - 2001-03-28 14:14:06
|
>I assume that you have included the line 'including namespace std;' or >'including std::list;' in there? i think the statement is 'using namespace std', but this stl seems to be a bit confused about where various things should go, and you can have things in the std namespace whether or not you 'using' it. anyway, that should cause a compiler error, and the problem here was a runtime error :O( thanks for the suggestion, richard _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. |
|
From: James G. <Jam...@Cl...> - 2001-03-28 14:36:42
|
Opps! That will teach me to try and remember this from a year ago rather than looking it up! What is the runtime error? I haven't tried this is a windows program but it's okay in console mode? Regards, James. -----Original Message----- From: Richard Asbury [mailto:dic...@ho...] Sent: Wednesday, March 28, 2001 3:14 PM To: dev...@li... Subject: RE: [Dev-C++] stl and windows apps >I assume that you have included the line 'including namespace std;' or >'including std::list;' in there? i think the statement is 'using namespace std', but this stl seems to be a bit confused about where various things should go, and you can have things in the std namespace whether or not you 'using' it. anyway, that should cause a compiler error, and the problem here was a runtime error :O( thanks for the suggestion, richard _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. _______________________________________________ Dev-cpp-users mailing list Dev...@li... http://lists.sourceforge.net/lists/listinfo/dev-cpp-users * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * This electronic message and any attachment is intended to be read by the named addressee(s) only. Any other recipient should be aware that its contents may be legally privileged and/or confidential and that its use, disclosure, copying or distribution may be unlawful. Unless you are a named addressee, please delete this message Whilst C. & J. Clark International Limited has taken steps to prevent the transmission of computer viruses with electronic mail, responsibility for screening incoming messages and the risk of such transmission and its consequences lies with the recipient. C. & J. Clark International Limited Registered in England and Wales Company No. 141015 Registered Office: 40 High Street, Street, Somerset BA16 0YA Telephone: +44 (0) 1458 443131 Fax: +44 (0) 1458 447547 |
|
From: Richard A. <dic...@ho...> - 2001-03-28 18:11:13
|
>What is the runtime error? the runtime error is the usual Windows take-it-back-to-whoever-sold-it-to-you jobby... not fantastically specific :O( >I haven't tried this is a windows program but it's okay in console mode? yeah i've had hardly any trouble with the stl stuff in console mode - it's only when its built for windows that problems start appearing. it's especially annoying because i've been using the console to develop modules and make sure they're working, and then when i move them into a proper windows app, they blow up without much hint of what's wrong. i've tried using the debugger on it (gdb with insight frontend) and it goes in to the std::list constructor before dying, so i take it there's a problem with the stl, or some compiler option i'm setting/not setting which is needed. richard _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. |
|
From: Richard A. <dic...@ho...> - 2001-03-31 13:23:22
|
>I know what the problem is. > > > #include "windows.h" > >should be > >#include <windows.h> > hmmm... i tried changing it in my code but still got the same error (i think it gets the same windows.h regardless of the include method) but then i looked more closely at your code and realised that you had your #include <windows.h> *before* your #include <list> where i had it after. apparantly, this makes all the difference :O) many thanks, richard _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. |
|
From: <jos...@ya...> - 2001-04-02 06:50:13
|
Good observation. I didn't know that. As a standard I always include the windows headers first and the C/C++ headers after. I never thought the order was important. Now I learnt something new. Thanks Chemanuel --- Richard Asbury <dic...@ho...> wrote: > > >I know what the problem is. > > > > > #include "windows.h" > > > >should be > > > >#include <windows.h> > > > > hmmm... i tried changing it in my code but still got the same error > (i think > it gets the same windows.h regardless of the include method) but then > i > looked more closely at your code and realised that you had your > #include > <windows.h> *before* your #include <list> where i had it after. > apparantly, > this makes all the difference :O) > > many thanks, > > richard > _________________________________________________________________________ > Get Your Private, Free E-mail from MSN Hotmail at > http://www.hotmail.com. > > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > http://lists.sourceforge.net/lists/listinfo/dev-cpp-users __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/?.refer=text |
|
From: <jos...@ya...> - 2001-03-29 07:14:25
|
I know what the problem is.
> #include "windows.h"
should be
#include <windows.h>
I tried this and works. When I tried your code it showed the annoying
error message.
#include <windows.h>
#include <list>
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
list<int> li;
MessageBox(0, "list created", "Test", MB_OK);
return 0;
}
Chemanuel
__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/?.refer=text
|
|
From: Andre` N. C. <ca...@op...> - 2001-03-29 12:47:16
|
I have a quick question how do you know when to use "" or <> when typing includes? I.E. #include "resource.h" Jose Manuel Padron Carrillo wrote: > I know what the problem is. > > > #include "windows.h" > > should be > > #include <windows.h> > |
|
From: guus <gzu...@de...> - 2001-03-29 13:23:19
|
You should use the " " if the include files aren't in the same directory as the compilers directory.(Set the path to....) You must use the <> if the include files are in the compilers directory. ----- Original Message ----- From: Andre` Niel Cameron <ca...@op...> To: <dev...@li...> Sent: Thursday, March 29, 2001 2:46 PM Subject: Re: [Dev-C++] stl and windows apps > I have a quick question how do you know when to use "" or <> when typing > includes? I.E. > #include "resource.h" > > Jose Manuel Padron Carrillo wrote: > > > I know what the problem is. > > > > > #include "windows.h" > > > > should be > > > > #include <windows.h> > > > > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > http://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
|
From: Michael P. <mdp...@ya...> - 2001-03-29 23:06:25
|
I believe that the <> will search for the file in the include directories as specified in Dev_C++. The "" will use the systems (windows) path resolution. Anyone else have a better definition? --- Andre` Niel Cameron <ca...@op...> wrote: > I have a quick question how do you know when to use > "" or <> when typing > includes? I.E. > #include "resource.h" > > Jose Manuel Padron Carrillo wrote: > > > I know what the problem is. > > > > > #include "windows.h" > > > > should be > > > > #include <windows.h> > > > > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > http://lists.sourceforge.net/lists/listinfo/dev-cpp-users __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/?.refer=text |
|
From: <jos...@ya...> - 2001-03-30 06:51:09
|
I found these definitions in my archive
**********************************************************************
There are two slightly different formats for file inclusion: one using
"" and the other using <>
1) #include <myfile.h> says to look in established system directories
for the file to include. How these system directories are established
and where they are located is system dependent; that is, it depends
upon the system on which you are working.
2) #include "myfile.h" says to look in your current directory for the
file. If not found there, the preprocessor will look in the system
directory. This is not necessarily true for all
compilers/preprocessors.
*********************************************************************
This is from WinAPI
The #include directive causes resource compiler to process the file
specified in the filename parameter. This file should be a header file
that defines the constants used in the resource-definition file. Use
the statement
#ifndef RC_INVOKED
in your header file to surround statements that can be compiled by a C
compiler but not RC. This way, you can use the same include files in
your .C and .RC files.
Syntax
#include filename
Parameter
filename
Specifies the name of the file to be included. If the file is in the
current directory, the string must be enclosed in double quotation
marks; if the file is in the directory specified by the INCLUDE
environment variable, the string must be enclosed in less-than and
greater-than characters (<>). You must give a full path enclosed in
double quotation marks (") if the file is not in the current directory
or in the directory specified by the INCLUDE environment variable.
Example
This example processes the header files WINDOWS.H and HEADERS\MYDEFS.H
while compiling the resource-definition file:
#include <windows.h>
#include "headers\mydefs.h"
**********************************************************************
As a rule of thumb I can say
1) If you're including headers from the compiler/stl/etc use <>
2) If you're including your own header files use ""
Hope this clarifies
Chemanuel
--- Michael Potter <mdp...@ya...> wrote:
> I believe that the <> will search for the file in the
> include directories as specified in Dev_C++.
>
> The "" will use the systems (windows) path resolution.
>
> Anyone else have a better definition?
__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/?.refer=text
|