dev-cpp-users Mailing List for Dev-C++
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(15) |
Oct
(115) |
Nov
(154) |
Dec
(258) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
(377) |
Feb
(260) |
Mar
(249) |
Apr
(188) |
May
(152) |
Jun
(150) |
Jul
(195) |
Aug
(202) |
Sep
(200) |
Oct
(286) |
Nov
(242) |
Dec
(165) |
| 2002 |
Jan
(245) |
Feb
(241) |
Mar
(239) |
Apr
(346) |
May
(406) |
Jun
(369) |
Jul
(418) |
Aug
(357) |
Sep
(362) |
Oct
(597) |
Nov
(455) |
Dec
(344) |
| 2003 |
Jan
(446) |
Feb
(397) |
Mar
(515) |
Apr
(524) |
May
(377) |
Jun
(387) |
Jul
(532) |
Aug
(364) |
Sep
(294) |
Oct
(352) |
Nov
(295) |
Dec
(327) |
| 2004 |
Jan
(416) |
Feb
(318) |
Mar
(324) |
Apr
(249) |
May
(259) |
Jun
(218) |
Jul
(212) |
Aug
(259) |
Sep
(158) |
Oct
(162) |
Nov
(214) |
Dec
(169) |
| 2005 |
Jan
(111) |
Feb
(165) |
Mar
(199) |
Apr
(147) |
May
(131) |
Jun
(163) |
Jul
(235) |
Aug
(136) |
Sep
(84) |
Oct
(88) |
Nov
(113) |
Dec
(100) |
| 2006 |
Jan
(85) |
Feb
(119) |
Mar
(33) |
Apr
(31) |
May
(56) |
Jun
(68) |
Jul
(18) |
Aug
(62) |
Sep
(33) |
Oct
(55) |
Nov
(19) |
Dec
(40) |
| 2007 |
Jan
(22) |
Feb
(49) |
Mar
(34) |
Apr
(51) |
May
(66) |
Jun
(43) |
Jul
(116) |
Aug
(57) |
Sep
(70) |
Oct
(69) |
Nov
(97) |
Dec
(86) |
| 2008 |
Jan
(32) |
Feb
(47) |
Mar
(106) |
Apr
(67) |
May
(28) |
Jun
(39) |
Jul
(31) |
Aug
(25) |
Sep
(18) |
Oct
(25) |
Nov
(5) |
Dec
(21) |
| 2009 |
Jan
(33) |
Feb
(27) |
Mar
(27) |
Apr
(22) |
May
(22) |
Jun
(10) |
Jul
(17) |
Aug
(9) |
Sep
(21) |
Oct
(13) |
Nov
(4) |
Dec
(11) |
| 2010 |
Jan
(10) |
Feb
(8) |
Mar
(4) |
Apr
(1) |
May
|
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(8) |
Oct
(26) |
Nov
(9) |
Dec
(1) |
| 2011 |
Jan
(21) |
Feb
(16) |
Mar
(4) |
Apr
(19) |
May
(26) |
Jun
(9) |
Jul
(6) |
Aug
|
Sep
(4) |
Oct
(3) |
Nov
(2) |
Dec
(1) |
| 2012 |
Jan
(4) |
Feb
(7) |
Mar
(4) |
Apr
|
May
(1) |
Jun
(10) |
Jul
(1) |
Aug
(1) |
Sep
(18) |
Oct
(3) |
Nov
(1) |
Dec
(1) |
| 2013 |
Jan
(4) |
Feb
(2) |
Mar
(15) |
Apr
(6) |
May
(1) |
Jun
(3) |
Jul
(1) |
Aug
(2) |
Sep
(4) |
Oct
|
Nov
(9) |
Dec
|
| 2014 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(5) |
Aug
(4) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
(4) |
| 2015 |
Jan
(2) |
Feb
(3) |
Mar
(1) |
Apr
(2) |
May
(1) |
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(2) |
Oct
(9) |
Nov
(35) |
Dec
(6) |
| 2016 |
Jan
(7) |
Feb
(10) |
Mar
(10) |
Apr
(9) |
May
(13) |
Jun
(9) |
Jul
(1) |
Aug
(3) |
Sep
(3) |
Oct
(1) |
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
(1) |
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
1
|
2
(1) |
3
(3) |
4
(2) |
5
(7) |
6
(2) |
|
7
(3) |
8
|
9
(2) |
10
(7) |
11
(14) |
12
(9) |
13
|
|
14
(6) |
15
(1) |
16
(2) |
17
(12) |
18
(8) |
19
(7) |
20
(5) |
|
21
(3) |
22
(3) |
23
|
24
|
25
(9) |
26
(10) |
27
(4) |
|
28
(3) |
29
(9) |
30
(3) |
31
(1) |
|
|
|
|
From: Paul P. <P.P...@cu...> - 2005-08-31 01:21:55
|
I'm not sure I'd really call this a bug or just an annoyance, anyway I'm running ver 4.9.9.2 on Xp Pro ,if I add / delete a variable within a class it doesn't seem to appear / disappear in the class window until after I reload the project. Has anyone else seen this behaviour or do I have some obscure option set wrong somewhere? =20 Paul |
|
From: LETCHUMANAN S. <arl...@ya...> - 2005-08-30 04:25:00
|
Dear all, I would like to protect my files and folders using c source code. I don't want other users to change or delete my folders and files. I have tried using Windows protection, but it doesn't work properly with c. I'm now trying to put my program in a Server directory and then create a Shortcut icon on the desktop.If I try to execute my program from the Desktop, I can't do it. Because the folders all are blocked, and no permission at all. That is the reason, I would like to protect my files and folders using c source code and I don't want other users to change or delete my folders and files. Can anyone please help me on this matter. I really need your help. Thank you, Letchu... --------------------------------- Meet your soulmate! Yahoo! Asia presents Meetic - where millions of singles gather |
|
From: Ray K. <kul...@wr...> - 2005-08-30 01:49:29
|
I'm guessing the error message you're receiving is "syntax error before '/' token". If this is the case, go to project options (alt+p), click compiler tab, and disable the "Support all ANSI standard C Programs" item. // style comments were added with C99, and weren't in the original ANSI version. On Mon, 29 Aug 2005 15:50:18 -0700, "Richard Van Wyk" <ric...@ai...> wrote: > My Dev C++ is not recognising "//" comments. > I think it is broken. > Richard |
|
From: lordSauron <lor...@gm...> - 2005-08-30 01:42:10
|
Is that the only error? Many times one error will create others (many of which make you almost certain that the makers of the compiler were on drugs) that have almost no relation to the actual problem. |
|
From: lordSauron <lor...@gm...> - 2005-08-29 23:35:20
|
It could be that he's using C. I don't remember, but I thought that '//' was a C++ feature, and if he's using C, it might not work. |
|
From: Per W. <pw...@ia...> - 2005-08-29 22:49:04
|
Are you talking about syntax highlighting in the editor, or errors from the compiler when building the application? Is it a C or C++ source file? Have you specified any specific flags to the compiler, to specify language standard or similar? /Per W On Tue, 30 Aug 2005, Richard Van Wyk wrote: > My Dev C++ is not recognising "//" comments. > I think it is broken. > > > Richard > > |
|
From: Richard V. W. <ric...@ai...> - 2005-08-29 22:42:40
|
My Dev C++ is not recognising "//" comments. I think it is broken. Richard |
|
From: Per W. <pw...@ia...> - 2005-08-29 22:24:45
|
Remember that just about all drivers (most OS) are written in C (which is also the most common language for operating systems), so they are more or less normal code with the exception that they might have a bit more clutter because of synchronization, hot-plug etc. /Per W On Mon, 29 Aug 2005, Alfred P. Reaud wrote: > All true Per. Regardless my point was that low level IO isn't usually done in high level languages, and Google should be a powerful tool in the search for knowledge, especially at the instructional level. You seem to have taken umbrage, Per, when no offense was intended, or at least that is how I take the tone of your response. If that is the case, then my humble apologies. |
|
From: Alfred P. R. <al...@ya...> - 2005-08-29 21:04:36
|
All true Per. Regardless my point was that low level IO isn't usually done in high level languages, and Google should be a powerful tool in the search for knowledge, especially at the instructional level. You seem to have taken umbrage, Per, when no offense was intended, or at least that is how I take the tone of your response. If that is the case, then my humble apologies. Per Westermark <pw...@ia...> wrote: Security from snooping? That is done by strong encryption. <snip> Anyway, to be able to give reasonable help/recommendations it very much helps to know the why. A lot of people ask very specific questions about problems that are not relevant. What use is it to help them to fix a bug in an incorrectly chosen algorithm instead of telling them which algorithm they should have used? The quality of expected answers very much depends on the quality of the question. /Per W <snip> Alfred P. Reaud |
|
From: Per W. <pw...@ia...> - 2005-08-29 19:45:07
|
Security from snooping? That is done by strong encryption. Security from data loss? That is done by journaling or similar for power failures and mirrored or check-summed data to handle hardware failures. Data recovery? Journaling, ECC, check-sum, mirroring or similar.. Reasons for thinking about direct access - or for intercepting driver accesses might be: - extremely high-end database using custom-optimized file system. - cryptographic layer doing sector-by-sector encryption. - routing layer for faking a local harddrive over the network. - storage manager layer for glueing multiple drives dynamically or statically into larger drives. - software RAID. - support for foreign file systems natively or in "user mode". - repartitioning drives, growing/shrinking/converting file systems. - media rotation layer for supporting media with limited write counts. - repair of broken file system. - ... Most of above cases exists for free or almost free, or are so very out of scope for real use that it isn't economical to develop a solution unless the target application can be sold for _big_ sums of money. www.sysinternals.com have some nice articles about file systems and how to build your own disk defragger for example. Anyway, to be able to give reasonable help/recommendations it very much helps to know the why. A lot of people ask very specific questions about problems that are not relevant. What use is it to help them to fix a bug in an incorrectly chosen algorithm instead of telling them which algorithm they should have used? The quality of expected answers very much depends on the quality of the question. /Per W On Mon, 29 Aug 2005, Alfred P. Reaud wrote: > IMHO, there are many reasons for doing such, including security, data recovery, etc. However, I've never seen this done in C/C++. As you have to access low level IO functions, this is preferentially done is assembly, as I don't believe C/C++ have this capability. At least, I've never found the need to research it. > > I would recommend Googling for low level disk IO. If you're really diligent, you can find out that there are undocumented features to disk controllers that significantly enhance data security. > > Per Westermark <pw...@ia...> wrote: > Since reading/wringing directly to the drive requires access to the > physical hardware, I have to ask exactly why you have this need. What are > you trying to do? > > /Per W > > On Mon, 29 Aug 2005, rc...@bi... wrote: > > > > > Dear sir, > > > > I see how to read/write to files using C. But I need to to define a track/sector that I can read and write to it under my control. Could > > you help me pointing out documents/sites with this information or teatching me how to do this. > > > > Thanks for your help > > > > Roger > <snip> > > > > > Alfred P. Reaud > > > |
|
From: Alfred P. R. <al...@ya...> - 2005-08-29 19:06:37
|
IMHO, there are many reasons for doing such, including security, data recovery, etc. However, I've never seen this done in C/C++. As you have to access low level IO functions, this is preferentially done is assembly, as I don't believe C/C++ have this capability. At least, I've never found the need to research it. I would recommend Googling for low level disk IO. If you're really diligent, you can find out that there are undocumented features to disk controllers that significantly enhance data security. Per Westermark <pw...@ia...> wrote: Since reading/wringing directly to the drive requires access to the physical hardware, I have to ask exactly why you have this need. What are you trying to do? /Per W On Mon, 29 Aug 2005, rc...@bi... wrote: > > Dear sir, > > I see how to read/write to files using C. But I need to to define a track/sector that I can read and write to it under my control. Could > you help me pointing out documents/sites with this information or teatching me how to do this. > > Thanks for your help > > Roger <snip> Alfred P. Reaud |
|
From: Per W. <pw...@ia...> - 2005-08-29 18:19:13
|
Since reading/wringing directly to the drive requires access to the physical hardware, I have to ask exactly why you have this need. What are you trying to do? /Per W On Mon, 29 Aug 2005, rc...@bi... wrote: > > Dear sir, > > I see how to read/write to files using C. But I need to to define a track= /sector that I can read and write to it under my control. Could > you help me pointing out=A0documents/sites with this information or teatc= hing me how to do this. > > Thanks for your help > > Roger > > ------------------------------------------------------- SF.Net email is S= ponsored by the Better Software Conference & EXPO September > 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile &= Plan-Driven Development * Managing Projects & Teams * Testing & > QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce= 5sf _______________________________________________ > Dev-cpp-users mailing list Dev...@li... TO UNSUBSC= RIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
|
From: <rc...@bi...> - 2005-08-29 15:55:27
|
<p>Dear sir,</p><p /><p style="">I see how to read/write to files using C. But I need to to define a track/sector that I can read and write to it under my control. Could you help me pointing out documents/sites with this information or teatching me how to do this.</p><p /><p>Thanks for your help</p><p /><p style="">Roger</p> |
|
From: rubberchickensarefunny <rub...@ya...> - 2005-08-28 18:15:10
|
trying the following code to test SQL connection to MS SQL server using machine DNS name.
receivng errors:
[linker error] undefined reference to 'SQLAllocEnv@4'
[linker error] undefined reference to 'SQLAllocConnect@8'
(etc. for all SQL function calls in the code)
using Dev-C++ 4.9.9.2 and the latest mingw WindowsAPI package (where the sql header files are)
I've found others who have had the same problem, but no solution - going nuts!
test code:
#include <windows.h>
#include <sqlext.h>
#include <cstdlib>
#include <iostream>
int main(int argc, char *argv[])
{
HENV hEnv = NULL; // Env Handle from SQLAllocEnv()
HDBC hDBC = NULL; // Connection handle
HSTMT hStmt = NULL;// Statement handle
UCHAR szDSN[SQL_MAX_DSN_LENGTH] = "mydsn";// Data Source Name buffer
UCHAR szUID[13] = "username";// User ID buffer
UCHAR szPasswd[7] = "passwd";// Password buffer
UCHAR szModel[128];// Model buffer
SDWORD cbModel;// Model buffer bytes recieved
UCHAR szSqlStr[128]= "SELECT test FROM testtable where test = 'test_success'";
RETCODE retcode;
// Allocate memory for ODBC Environment handle
SQLAllocEnv (&hEnv);
// Allocate memory for the connection handle
SQLAllocConnect (hEnv, &hDBC);
// Connect to the data source "szDSN" using userid and password.
retcode = SQLConnect (hDBC, szDSN, SQL_NTS, szUID, SQL_NTS, szPasswd, SQL_NTS);
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
{
// Allocate memory for the statement handle
retcode = SQLAllocStmt (hDBC, &hStmt);
// Prepare the SQL statement by assigning it to the statement handle
retcode = SQLPrepare (hStmt, szSqlStr, sizeof (szSqlStr));
// Execute the SQL statement handle
retcode = SQLExecute (hStmt);
// Project only column 1 which is the models
SQLBindCol (hStmt, 1, SQL_C_CHAR, szModel, sizeof(szModel), &cbModel);
// Get row of data from the result set defined above in the statement
retcode = SQLFetch (hStmt);
// Free the allocated statement handle
SQLFreeStmt (hStmt, SQL_DROP);
// Disconnect from datasource
SQLDisconnect (hDBC);
}
std::cout << retcode << "\n";
// Free the allocated connection handle
SQLFreeConnect (hDBC);
// Free the allocated ODBC environment handle
SQLFreeEnv (hEnv);
system("PAUSE");
return EXIT_SUCCESS;
}
---------------------------------
Start your day with Yahoo! - make it your home page |
|
From: <m....@ho...> - 2005-08-28 17:10:00
|
Hi! =20 Just tiies to install Dev-C++ v 4.9.9.2 at my homecomputer, but = something is wrong... =20 The installation complets without problems, but when I try i use Dev-C++ = the problem starts.... =20 I then opens a exampleproject like "Jackpot" and then tries to compile. But when I do this I get an error in the Compile Log that says something about "No such file or directory" ?!?! =20 I tried to copy and paste the logmessage but it dosen't work :-((( I have installed Dev-C++ at many other computers without any problems, = so this is most disturbing for me. =20 Any ideas anybody??? =20 |
|
From: David M. <dml...@co...> - 2005-08-28 16:28:38
|
Have you checked for foo.exe in the same directory as foo.cpp? Have you tried hitting the execute button (the one that looks like a console window right next to the compile button)? As long as you don't see any error messages then the compilation went fine. The line "execution terminated" is simply telling you that the compiler is done and either you have some errors to fix or you code is ready to run. lordSauron wrote: >On 8/27/05, neo...@fu... <neo...@fu...> wrote: > > >>Whenever I attempt to compile a .cpp, even a single, self-contained .cpp file, I get this in the compiler log: >> >> > > > >>Compiler: Default compiler >>Executing g++.exe... >>g++.exe "foo.cpp" -o "foo.exe" >>Execution terminated >> >> > >What's it doing executing? I don't understand that. > > > >>I'm on Windows XP, though I've recently. How can I fix this? Am I doing something wrong? I've used other compilers before without issue on other machines... but I'm looking for one to work on for personal projects. >> >> > >Want to know a big secret? GCC is really one of the better C/C++ >compilers around. My dad, whose a defense contractor for the US DoD, >when they have something that they either can't get to run fast enough >on their expensive Microsoft and Borland compilers, use the G++, and >usually get far better performance and reliability. G++ is really >nice in that it's free, the best there is, and is so scalable that >it'll work like a charm for everything from helloworld.c to >missle_defense_algorithm.cpp and everything in between. > >As for your error, to me it sounds like you made files but no project. > DevC++ is odd in this manner. When you create a project, it keeps a >list of all the files it needs to send during compile. If you're not >developing with a project, you need to make one and add the files to >it. However, you were really vauge, so I could very easily be miles >from the truth of your problem. Good luck though > > |
|
From: lordSauron <lor...@gm...> - 2005-08-27 23:50:23
|
On 8/27/05, neo...@fu... <neo...@fu...> wrote: > Whenever I attempt to compile a .cpp, even a single, self-contained .cpp = file, I get this in the compiler log: > Compiler: Default compiler > Executing g++.exe... > g++.exe "foo.cpp" -o "foo.exe" > Execution terminated What's it doing executing? I don't understand that. > I'm on Windows XP, though I've recently. How can I fix this? Am I doing s= omething wrong? I've used other compilers before without issue on other mac= hines... but I'm looking for one to work on for personal projects. Want to know a big secret? GCC is really one of the better C/C++ compilers around. My dad, whose a defense contractor for the US DoD, when they have something that they either can't get to run fast enough on their expensive Microsoft and Borland compilers, use the G++, and usually get far better performance and reliability. G++ is really nice in that it's free, the best there is, and is so scalable that it'll work like a charm for everything from helloworld.c to missle_defense_algorithm.cpp and everything in between. As for your error, to me it sounds like you made files but no project. DevC++ is odd in this manner. When you create a project, it keeps a list of all the files it needs to send during compile. If you're not developing with a project, you need to make one and add the files to it. However, you were really vauge, so I could very easily be miles from the truth of your problem. Good luck though! |
|
From: Alfred P. R. <al...@ya...> - 2005-08-27 23:41:52
|
More information is necessary. The only thing I can see looking at the gcc manpage is that "foo.cpp" should follow the -o "foo.exe". , As in [-o outfile] infile... See the gcc (1) man page. neo...@fu... wrote:Whenever I attempt to compile a .cpp, even a single, self-contained .cpp file, I get this in the compiler log: Compiler: Default compiler Executing g++.exe... g++.exe "foo.cpp" -o "foo.exe" Execution terminated I'm on Windows XP, though I've recently. How can I fix this? Am I doing something wrong? I've used other compilers before without issue on other machines... but I'm looking for one to work on for personal projects. <snip> Alfred P. Reaud |
|
From: <neo...@fu...> - 2005-08-27 23:05:53
|
Whenever I attempt to compile a .cpp, even a single, self-contained .cpp file, I get this in the compiler log: Compiler: Default compiler Executing g++.exe... g++.exe "foo.cpp" -o "foo.exe" Execution terminated I'm on Windows XP, though I've recently. How can I fix this? Am I doing something wrong? I've used other compilers before without issue on other machines... but I'm looking for one to work on for personal projects. |
|
From: Martin D. <nex...@qu...> - 2005-08-27 08:20:49
|
John Higgins wrote: > I down loaded Dev-C++ executable (for Window XP); then double clicked > it to install it. I received following message: > There doesn't seem to be GNU Make file in PATH or in Dev-C++'s Bin > path.... > > Do I need to go to the system folder and change PATH related information? > Why some other friends do not need to do it? > > John Because some other friends downloaded Dev-C++ package with compiler in it. If you could finish the installation, you should be able to download all required packages from WebUpdate. Otherwise download the big version of Dev-C++ unless you have GCC and GNU Make already installed somewhere on your computer. Happy coding, next_ghost |
|
From: John H. <jhi...@ya...> - 2005-08-26 23:39:52
|
I down loaded Dev-C++ executable (for Window XP); then double clicked it to install it. I received following message: There doesn't seem to be GNU Make file in PATH or in Dev-C++'s Bin path.... Do I need to go to the system folder and change PATH related information? Why some other friends do not need to do it? John __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
|
From: Fibre O. <fib...@go...> - 2005-08-26 19:09:53
|
Alfred P. Reaud wrote: > A Google search for 'C++ tutorial, "college level" > <http://www.google.com/search?hl=en&lr=&rls=GGLG%2CGGLG%3A2005-32%2CGGLG%3Aen&q=C%2B%2B+tutorials+%22college+level%22>' > gave some very interesting results. One of the better ones was > Academic Resource Links > <http://staff.southwest.tn.edu/kfoster/links_4.htm> - C/C++ > Programming > <http://staff.southwest.tn.edu/kfoster/links_4.htm#cplus>. Lots of > other goodies on that site for not just for geeks and techies, but > also for other academic fields. > > */"G.C.Harmon" <gc...@gc...>/* wrote: > > Does anyone out there know of any on-line courses in C++ programming? > Preferably college level and not the short tutorials I have found. In > lieu of that, anyone recommend a good teach yourself book(s)? > > Many thanks, > G. C. Harmon > <snip> > > try this:http://www.planetpdf.com/developer/article.asp?ContentID=6634 |
|
From: P.D. v. Z. <pa...@di...> - 2005-08-26 15:39:02
|
I usually find it easier to just typedef the map you're using. So, in
your case you'd have something like:
typedef map<string, string> StringMap;
It makes other code a lot shorter and easier to read.
For instance, your iterators could be declared like this:
StringMap::iterator iter;
And your typedef for valType could be written like this:
typedef StringMap::value_type valType;
On another note; why do you have "void main"? This is illegal in C++,
and should not compile (even after you fix the other errors in your code).
Also, you should always use the pre-increment operator on iterators, as
using the other variant may have unnecessary performance penalties
(because it has to store and return the previous value of the iterator,
which may be expensive on custom iterators).
A modified version of your code that does compile and work correctly is:
#include <map>
#include <string>
#include <iostream>
using namespace std;
int main()
{
typedef map<string, string> StringMap;
typedef StringMap::value_type valType;
StringMap trans_map;
trans_map.insert(valType("gratz", "grateful"));
trans_map.insert(valType("'em", "them" ));
trans_map.insert(valType("cuz", "because" ));
trans_map.insert(valType("nah", "no" ));
trans_map.insert(valType("sez", "says" ));
trans_map.insert(valType("tanx", "thanks" ));
trans_map.insert(valType("wuz", "was" ));
trans_map.insert(valType("pos", "suppose" ));
StringMap::iterator iter;
for (iter = trans_map.begin(); iter != trans_map.end(); ++iter)
cout << (*iter).first << '\t' << (*iter).second << endl;
return 0;
}
Regards,
Paul
bhadram rao wrote:
> Dear frinends,
> I'd a problem. The problem is that I want to know how
> to iterate through the map if i am iterating like those in code there
> problems like '=' cannot find the overload operator etc.. How to solve
> this problem .Also i want to know the importance of allocator. why it is
> used. why it is only used in iterator rather than in map definition.
>
> Please help me.
>
>
> Thanking you,
> yours sincerely,
> bhadram
>
>
> # include <map>
> # include<string>
> # include <iostream>
> using namespace std;
> void main()
> {
> map<string,string > trans_map;
> typedef map<string,string >::value_type valType;
> trans_map.insert( valType( "gratz", "grateful" ));
> trans_map.insert( valType( "'em", "them" ));
> trans_map.insert( valType( "cuz", "because" ));
> trans_map.insert( valType( "nah", "no" ));
> trans_map.insert( valType( "sez", "says" ));
> trans_map.insert( valType( "tanx", "thanks" ));
> trans_map.insert( valType( "wuz", "was" ));
> trans_map.insert( valType( "pos", "suppose" ));
> map<string,less<string>,allocator<string> >::iterator iter;
> map<string,less<string>,allocator<stirng> >::iterator
> iter_end=trans_map.end();
> for(iter=trans_map.begin();iter!=iter_end;iter++)
> {
> cout<<(*iter).first<<" "<<(*iter).second<<endl;
> }
> }
>
> errors are :
>
> D:\cpppractice\aug22\textcpp.cpp(21) : error C2679: binary '=' : no
> operator defined which takes a right-hand operand of type 'class
> std::_Tree<class std::basic_string<char,struct
> std::char_traits<char>,class std::allocator<char> >,struct std::pair<
> class std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> > const ,class std::basic_string<char,struct
> std::char_traits<char>,class std::allocator<char> > >,struct
> std::map<class std::basic_string<char,struct std::char_tr
> aits<char>,class std::allocator<char> >,class
> std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> >,struct std::less<class
> std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> > >,class std::all
> ocator<class std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> > > >::_Kfn,struct std::less<class
> std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> > >,class std::allocator<class std::basic
> _string<char,struct std::char_traits<char>,class std::allocator<char> >
>> >::iterator' (or there is no acceptable conversion)
> D:\cpppractice\aug22\textcpp.cpp(21) : error C2679: binary '!=' : no
> operator defined which takes a right-hand operand of type 'class
> std::_Tree<_K,_Ty,_Kfn,_Pr,_A>::iterator' (or there is no acceptable
> conversion)
> D:\cpppractice\aug22\textcpp.cpp(23) : error C2679: binary '<<' : no
> operator defined which takes a right-hand operand of type 'struct
> std::less<class std::basic_string<char,struct
> std::char_traits<char>,class std::allocator<char> > >' (or there is
> no acceptable conversion)
> Error executing cl.exe.
> textcpp.obj - 6 error(s), 14 warning(s)
>
>
>
> ------------------------------------------------------------------------
> Start your day with Yahoo! - make it your home page
> <http://us.rd.yahoo.com/evt=34442/*http://www.yahoo.com/r/hs>
|
|
From: bhadram r. <bha...@ya...> - 2005-08-26 07:05:39
|
Dear frinends,
I'd a problem. The problem is that I want to know how to iterate through the map if i am iterating like those in code there problems like '=' cannot find the overload operator etc.. How to solve this problem .Also i want to know the importance of allocator. why it is used. why it is only used in iterator rather than in map definition.
Please help me.
Thanking you,
yours sincerely,
bhadram
# include <map>
# include<string>
# include <iostream>
using namespace std;
void main()
{
map<string,string > trans_map;
typedef map<string,string >::value_type valType;
trans_map.insert( valType( "gratz", "grateful" ));
trans_map.insert( valType( "'em", "them" ));
trans_map.insert( valType( "cuz", "because" ));
trans_map.insert( valType( "nah", "no" ));
trans_map.insert( valType( "sez", "says" ));
trans_map.insert( valType( "tanx", "thanks" ));
trans_map.insert( valType( "wuz", "was" ));
trans_map.insert( valType( "pos", "suppose" ));
map<string,less<string>,allocator<string> >::iterator iter;
map<string,less<string>,allocator<stirng> >::iterator iter_end=trans_map.end();
for(iter=trans_map.begin();iter!=iter_end;iter++)
{
cout<<(*iter).first<<" "<<(*iter).second<<endl;
}
}
errors are :
D:\cpppractice\aug22\textcpp.cpp(21) : error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class std::_Tree<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::pair<
class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,struct std::map<class std::basic_string<char,struct std::char_tr
aits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::all
ocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >::_Kfn,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<class std::basic
_string<char,struct std::char_traits<char>,class std::allocator<char> > > >::iterator' (or there is no acceptable conversion)
D:\cpppractice\aug22\textcpp.cpp(21) : error C2679: binary '!=' : no operator defined which takes a right-hand operand of type 'class std::_Tree<_K,_Ty,_Kfn,_Pr,_A>::iterator' (or there is no acceptable conversion)
D:\cpppractice\aug22\textcpp.cpp(23) : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >' (or there is
no acceptable conversion)
Error executing cl.exe.
textcpp.obj - 6 error(s), 14 warning(s)
---------------------------------
Start your day with Yahoo! - make it your home page |
|
From: bhadram r. <bha...@ya...> - 2005-08-26 04:15:45
|
Dear friends,
In vc++ compiler i'm getting this warning. Please any one can help me why this warning is comming and how to avoid it.
warning C4091: 'typedef ' : ignored on left of 'class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > > >' when no variable is declared
I'm using definitions like
typedef vector<string,allocator<string> > vec;
typedef pair<short,short> location;
typedef vec<location,allocator<location> > locations_def;
typedef pair<vec*,locations_vec*> text_locations_pair;
in my program.
Another question is why to give space at last in vector defintions in vc++ compiler
why vector<string,allocator> will not work in this compiler.
If you've answers please mail me and help me
Thanking you,
yours sincerely,
bhadram
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com |