|
I dont know about you but I find the new Visual C++ to be a lot cleaner than the previous VC++. The simple reason being the concept of partial classes where the code wizard writes code in a separate file but for the same class. So there is 1 file with your implementation and one with the code gen. There is no need to find you way through the code and make changes or insert code as in 2003 at times. It does not support .net 1.1 framework but does it for .net 2.0. The GUI that u can build is very Office 2003 like...so it looks updated
cheers
Rahul
|
|
|
|
|
Yes, it is worth upgrading.
Someone blamed for my nickname to be destructive, I wonder what he would have said about yours
~RaGE();
|
|
|
|
|
I ave tryed 2003 and 2005 but after some disaventure (serialization of CObject defined in extension DLL see IMPLEMENT_SERIAL_EXTDLL ecc.. distributing executables ecc..) I use VC++ 6!
|
|
|
|
|
The upgrade is worth doing.
topus wrote: I use VC++ 6!
But yes, VC++ 6 still ROCKS!
Regards,
Rajesh R. Subramanian
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
|
|
|
|
|
;P
not so bad, but quite old nowaday
i still use it, but only when i maintain a project a create under VC++6 that i don't want to port to VC++7.1.
now, when i create new projects, i use VC++2003 (i don't have VS2005 except a beta2), and i find it pretty cool compared to VC6 (which keep me nostalgic )
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
topus wrote: I use VC++ 6!
Yep, still a good IDE but there are some minor bugs with the compiler. If I remember correctly (not sure anymore), you will have compile errors when you have a class with a private destructor and a public function that auto-deletes the object (something like):
void MyClass::Destroy()<br />
{<br />
delete this;<br />
}
The compiler will tell you that the class cannot access the destructor as it is private.
There were also some minor bugs with the STL I think but I cannot remember anymore which ones.
|
|
|
|
|
|
Morning, got a quick question here
<br />
for(std::vector<std::string>::iterator iterString = myVec.begin(); iterString != myVec.end(); ++iterString)<br />
{<br />
if (*iterString == "someText") *iterString = "someOtherText";<br />
else if (*iterString == "someText2") *iterString = "someOtherText2";<br />
else return(-1);<br />
return(0);<br />
}<br />
Will changing a vector item using this kind of operation invalidate the iterator?
I cannot red it up: No docs, no books here, just the compiler, libs and web access.
Thanks in advance.
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
I would be very astonished if it does. Think of an iterator as a kind of pointer: when you access and change the content of the pointed data (with the * operator), it doesn't change the pointer itself so it is still pointing at the same 'address'.
Altought I never tested it before so I cannot say that will work. But still, this would be very illogical if you can't do it.
|
|
|
|
|
i think that such a question sebastian asked is justified when you know Java iterators... they actually invalidate when you try to modify the element they point on (or something very close).
but even if it is not the case in C++ (because modify the element will not reallocate automatically a new instance - which makes the iterator loose its address), i can understand his doubt...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
Thanks for you help, you two.
Actually, I was concerned with the "dynamic" nature of a vector. I was not sure how vectors handled resizing. I mean, I did not consider the nature of the std::string and std::vector. But your statements make sense: Even if the string did grow during my change, that would not require the vector to grow, since the string itself handles its own "dynamic size", not the vector containing it.
Its a typical case of "not thought through"
Thanks again.
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
This will not invalidate the iterators. Things what will:
- Inserting a item at the end **IF** reallocation occurs as a result.
- Inserting an item invalidates all iterators the refer to items after the inserted item and if reallocation occurs all iterators.
- Deleting an item invalidates all iterators the refer to items after the deleted item and if reallocation occurs all iterators.
I think that about covers it.
You can use the reserve function to specify how much storage to allocate so reallocation does not occur.
Steve
|
|
|
|
|
I have 2 classes, CPerson and CPersonDlg. Look at their relationship:
Person.h
--------
#include "PersonDlg.h"
class CPerson
{
...
public:
friend class CPersonDlg ;
...
} ;
PersonDlg.h
-----------
#include "Person.h"
class CPersonDlg
{
...
public:
CPerson m_pers ;
...
} ;
Person.cpp
----------
#include "Person.h"
....
...
PersonDlg.cpp
-------------
#include "PersonDlg.h"
...
...
PROBLEM
=======
I am getting the error "fatal error: unexpected end of file while looking for precompiled header directive". But If I add "#include "stdafx.h" in Person.cpp, I get another error "CPerson: class type redefinition"
Pls suggest me a solution.
Thanks in advance
Sarvan AL
|
|
|
|
|
In the project settings (right click on project in solution explorer -> properties) select "C/C++" and change "Precompiler headers" to "Not using precompiled headers". I also suggest removing stdafx from your source-code.
And: remove the circular includes, thats giving me the creeps. Have PersonDlg.h include Person.h.
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
-- modified at 4:03 Thursday 12th January, 2006
|
|
|
|
|
Sarvan AL wrote: I am getting the error "fatal error: unexpected end of file while looking for precompiled header directive". But If I add "#include "stdafx.h" in Person.cpp, I get another error "CPerson: class type redefinition"
To solve the first error you have to #include "stdafx.h" . To solve the second error place a #pragma once at the top of every one of your .h header files. What is happening now is that the compiler is including person.h multiple times so it is finding multiple definitions of class CPerson .
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
1. I have one similar problem please help me also. I tried to use a global variable in every c++ file with the same name that is szRegPath (a CString). But I got some error and I had to use either different variable names in all the files (if global) or i had to put those inside functions. How can I resolve this?
2. I want to have one int variable which is global to all the c++ files and that should maintain its value state. If one file modifies the value to 7, then when it is called by another file, it should have its value as 7.
Please help me
Aljechin Alexander
|
|
|
|
|
Declare the variable as external using "extern" in all the files.
(like ... extern CString szRegPath). Hope this helps.
Pls let us know your status.
|
|
|
|
|
I will try this and definitely write back
Thank you so much
Aljechin Alexander
|
|
|
|
|
extern CString strGlobal = "Initialization Value";
extern CString strGlobal;
AfxMessageBox(strGlobal);
This gives me an error telling one unresolved external symbol
Regards,
Aljechin Alexander
|
|
|
|
|
You got it backwards.
Put this in exactly ONE source file, your definition of the global variable:
extern CString strGlobal = "Initialization Value";
Put this in the header file, included by all source files that need access to the variable:
extern CString strGlobal;
That should work.
Marriage slows down your coding, a baby slows it down even more!
|
|
|
|
|
Blake Miller wrote: You got it backwards.
I am still not getting it
Please show me in stdafx.h what i should put, in MySample.cpp and MySample.h what I should put? There are about 10 files, say MySample2.h, MySample2.cpp, etc.. in those what I should put? Show me the code please. I have never done this before. Sorry if I am troubling too much.
Regards,
Aljechin Alexander
-- modified at 23:55 Thursday 12th January, 2006
|
|
|
|
|
MySample.H
extern CString strGlobal;
MySample.Cpp
#include "MySample.H"
// declare variable in ONLY one source file
CString strGlobal = "Initialization Value";
MyOtherSample.Cpp
#include "MySample.H"
|
|
|
|
|
Yes, I got it. As ....PJ Arends... said, I put #pragma once in all the .h files and #include "stdafx.h" as the first statement of all the .cpp files. Also I removed #include "PersonDlg.h" statement from the Person.h file. Now it works fine. But I have not changed the compiler option to "Not using percompiled header files..". Just I left it, as it is.
Thanks once again
Sarvan AL
|
|
|
|
|
In the project that i am developing i need to communicate between two and more exe. how can i carry this out?
|
|
|
|
|
There are many ways, it really depends on what your needs are. You can used the clipboard, memory mapped files, pipes, mailslots, DDE, WM_COPYDATA, or windows sockets, etc.
See the articles listed at http://www.codeproject.com/threads/#Inter%2DProcess+Communication[^]
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|