|
Andrew,
Thanks for the reply - that is very useful.
I tried to to a clean but I could not find the menu option.
Building in the Development Environment according to the help page I should be able to:-
To clean the active project
On the Build menu, choose Clean.
But I don't have a Clean option. Any suggestions?
By the way I am using Visual Studio 2003 .net
Thanks
|
|
|
|
|
LiamD wrote:
I don't have a Clean option. Any suggestions?
'Clean Solution' is the third item in the build menu in a default install of Visual Studio 2003. If it isn't in the right place try customising your menus / toolbars
|
|
|
|
|
Hi,
Can anyone ols help me how to execute a Java executable/code from C++?
Is it possible pls help
Thanks in Advance
Ram
|
|
|
|
|
cberam wrote:
Can anyone ols help me how to execute a Java executable/code from C++?
Is it possible pls help
Do you mean launch a Java program from C++ or call Java functions from C++?
For the first see: java+exe[^]
Directly calling Java functions from C++ is done with JNI[^]. This is an extremely clumsy, ugly, and almost unusable interface. Better start a Java program and call C++ functions (in a DLL) from the Java program. This is comparatively simple.
|
|
|
|
|
Hi,
Is there any size limit on an executable created? My Loader application creates an executable which hosts certain data files. But the exe (having 2 GB size) fails to execute , while it was successful to execute exe having 1.5GB size. I use Win2k professional with 256MB RAM.
Waiting for your valuable comments
Thanks,
Vini
|
|
|
|
|
I don't have any definite knowlege on this - but it stands to reason that windows would not like this at all. I think you may just have to bite the bullet, and turn it into a loader and "companion file". If this is an installer we're talking about, and you absolutly must have one file, you could try producing an MSI file instead of a self extracting installer.
Joel Holdsworth
Wanna give me a job this summer?
Check out my online CV and project history[^]
|
|
|
|
|
The system, on a regular x86 installation of Windows, will be unable to load an image that large because it will run out of virtual address space in the process.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
|
Maximilien wrote:
you mean your exe file is 2gig ?
I think he's saying his single-image setup.exe is > 2 gig...
~Nitron.
ññòòïðïðB A start
|
|
|
|
|
Hello,
If the exact size of the executable is more than 2GB the problem can be that windows has not enough adress space left to create a heap and / or a stack. I don't know if the linker will complain about having not enough adress space left...
But honestly, what were you thinking when you made that 1.5GB jumbo executable 500MB bigger? Like other people mentioned, you should try and put some of those MB's in a separate file.
I also got the blogging virus..[^]
|
|
|
|
|
Thanks for the comments.
My executable contains data to create a DVD movie. Its something like packing all data inside the executable and on execution it creates a DVD movie with the data it hosts. Its not a setup exe. I cannot put the data in seperate files. It has to be one single executable.
When the exe was 2 GB, it didn't issue any sys warning or error message, but a application error saying the header could not be read. I think the Loader didnot create the executable fully/properly. But with 1.5 GB data, it worked fine.
Vini
|
|
|
|
|
2GB executable file.
You must be kidding ...
Rahim Rattani
Software Engineer,
Matrix Systems (Pvt) Ltd.,
Karachi - Pakistan
|
|
|
|
|
Rahim Rattani wrote:
You must be kidding ...
No I am not.
Vini
|
|
|
|
|
Hi,
I have an application (in VC++ 6.0) wherein it displays the images in ListView. So the application starts displaying the images from the Top left corner (0,0).
Now I have added the manifest file (to give XP look to application) in applicatoin resource successfully. (as outlined in the below mentioned link http://www.codeguru.com/Cpp/controls/controls/article.php/c5227/[^])
The application is having the XP look but the images are displayed from the Bottom left corner.
Question:How to set the origin of the ListCtrl to top left corner (0,0) so that the images are displayed from the top left corner (0,0) ?
Thanks & Regards,
Neeraj
|
|
|
|
|
Hi,
Is there any C++ CLASS/API similar to JAVA "HttpURLConnection" .
Pls help
Thnaks
Ram
|
|
|
|
|
|
Hi,
I have a ActiveX component (3th party) in my own MFC project (Dialog, shared). If i run the project in developers studio i see some logging comming from the ActiveX component.
Now i want to write this logging to a file, without using developers studio. Somehow i don't get it to work. I tried to reroute the stdout/stderr stream, also the _CrtSetReportHook2 catches a lot...but not the activex logging.
Has anybody a idea how to get it done?
Many thanx,
Richard
|
|
|
|
|
Hi everyone!
My name's Duc , I'm from Vienam and I'm a student . I've just used
MFC(VC6.0).I think memory allocation is very important in programming,isn't it? I've tried to search in MSDN but it's not clear!So I want to ask you some question in my situation :
I have a class T which has a default destructor does nothing . T also
has a member variable : char *str; and a constructor :
T::T()
{
str=new char[200];
}
I allocate an object of class T in function f() by the new
operator like this :
void f()
{
T* pT=new T();
}
The question is : Will the memmory block(contains 200 bytes of str)
which is pointed to by pT be free(deallocated) when we leave the function
f()?What happens inside (when deallocating)?
Thank you for your listening and help!
Ky
|
|
|
|
|
HoDuc wrote:
I think memory allocation is very important in programming,isn't it
Yes, you can quickly go into real troubles
Ok, in your case, the memory allocated for your string won't be freed in your program. You need to free it in the destructor of your class:
T::~T()<br />
{<br />
if(str)<br />
{<br />
delete[] str;<br />
str = NULL;<br />
}<br />
}
[EDIT] Ok, I read your post a little bit to fast. One think that is really really important is that each new must have a corresponding delete to free the memory allocated by new. In your case, if you create a new object in your function, it won't be deleted automatically when leaving the function so you will first need to delete it. When deleting an object, this will automatically call the destructor of your class. And inside this destructor, you will free the memory allocated for your string. Easy, isn't it ? [\EDIT]
|
|
|
|
|
Ok, I will go a little bit deeper in details. It's true that it is a part that is not easy to understand at the begining.
The destructor of a class is there to free the memory that has been dynamically allocated (so with a new) for one or several member variables of your class (could do other things also but here we will just speak about the memory management). This is typically the place where you need to put the delete of str in your example. Even if the variable has not been allocated in the constructor for example !!
A good way of working is that if you don't allocate memory in the constructor for a pointer of your class, make it NULL:
T::T()<br />
{<br />
str = NULL;<br />
}
Thus, when you destructor will be called, you can check if this memory has been allocated or not and free it in the first case:
T::~T()<br />
{<br />
if(str)<br />
{<br />
delete[] str;<br />
str = NULL;<br />
}<br />
}
So, now when is the destructor of a class called ? Simple: whenever the object is being destroyed. By destroyed I mean not only when calling delete but also when your object (not allocated by new) goes out of scope. Example:
int foo()<br />
{<br />
T Object;<br />
....<br />
....<br />
return 0;<br />
}
In this case, your object has not been allocated dynamically but its destructor is called when the object is destroyed (leaving the function).
I hope this is a little bit clearer ? If you have further questions, do ask
|
|
|
|
|
HoDuc wrote:
Will the memmory block(contains 200 bytes of str)
which is pointed to by pT be free(deallocated) when we leave the function
no, it will free when a call of delete[] occurs, of when main leaves (and so, the system destroys the array)
HoDuc wrote:
What happens inside (when deallocating)?
if calls the destructors of each object in the tab before freeing the memory space... (soory, wrong)
it free the memory, even though the objects were "destructed"
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
T::T()
{str=new char[200];
}
void f()
{T* pT=new T();//no need to mention braces
}
in destructor u do the opposite of u did in CONSTRUCTOR
SO MENTION A DESTRUCTOR
T:~T()
{delete[] str;
}
in the void f()
delete pT; //mention in the f() where u dont require the
//pointer usually at the end of f()
which will call the above destructor
|
|
|
|
|
sunit5 wrote:
in destructor u do the opposite of u did in CONSTRUCTOR
No, not necessarily !! If you allocated your str elsewhere than in your constructor (and it happens very very often for me), you will have a memory leak then, because if I follow your rule, it won't be delete then...
Another thing: make 'safe destructions' before deleting an object, check if the pointer is not NULL, then delete the object and after that make it NULL (not really necessary but better be too much protective than the opposite ). And also, if your pointer is not allocated in the constructor, make it NULL so if it has not been yet allocated when your object is destroyed, it will not be deleted (and the opposite will result of a very very bad error message ).
So, a general rule I follow in my destructor: use this safe destruction for all pointers in your object and this is ok.
|
|
|
|
|
There is no point in part one of your safe destruction idea. The C++ delete operator takes care of the case where the pointer is NULL. So delete(NULL) is legal and does nothing. I do agree with your other ideas though, they are very helpful. Especially the bit about setting pointers to NULL on initialization..
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I had serious doubts about your statement, "The C++ delete operator takes care of the case where the pointer is NULL." So I did some digging in the CRT library source. It turns out that this statement is not totally correct. The C++ delete operator just ends up calling _free_dbg and that checks for a null pointer. In the end the null pointer is caught though and that is the bottom line.
|
|
|
|