|
The output file should be in the Release folder. In order to see or change this folder, open the project's properties dialog box and see the General --> Output Directory field.
|
|
|
|
|
Thanks. I am using the stdafx precompiled header, can I just transfer the .pch file from the debug to the release folder, or will that just end up creating a debug build instead of a release build?
Thanks
|
|
|
|
|
You will need to rebuild the whole application as "release", the precompile header will be redone in the release folder.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
No, the PCH files are different in Debug and Release build. You should rebuild your application, and the PCH file will be created by the compiler.
|
|
|
|
|
The compiler will not precompile the header automatically, and creates a fatal error, when I try to compile, because it is trying to read the precompiled header, and it is not able to find the file. Is there a setting that would be able to be reset to get the compiler to create the header?
|
|
|
|
|
In a normal project created by the Wizard, you should have the "stdafx.cpp" file. Right click on it in Solution Explorer and go to Properties dialog.
In the C/C++ --> Precompiled Headers --> Create/Use Precompiled Header, you should have "Create Precompiled Header" option.
For the rest of the files, actually for the entire project, in this field you should have "Use Precompiled Header".
If you still have troubles, maybe creating of a new project will help?
|
|
|
|
|
Thanks very much, that worked.
I don't think you can create a new managed c++ project (not windows forms) in express. I had to get a managed project, and then strip all the code out of it, so creating a new project probably wouldn't be a good idea
|
|
|
|
|
Hi,
I am changing my dialog based MFC application to SDI application.
I have the initialization code in TestDlg::OnInitDialog(), in the part
//TODO: Add extra initialization here
What is the equivalent function in SDI? Where can I add this extra initialization? I see CAppView::OnInitalUpdate() function, but there isn't
//TODO: Add extra initialization here comment.
Thanks,
Harsha
|
|
|
|
|
One such place is the document's OnOpenDocument() method, or the view's OnInitialUpdate() method. It really just depends on what it is that you are initializing.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi,
Thank you. I am adding the initialization code related to the controls I have
added on IDD_APP_FORM (Dialog).
So I guess I should add initialization code to view's OnInitialUpdate() method.
In which case document's OnOpenDocument() method is used?
Thanks,
Harsha
|
|
|
|
|
harsha1305 wrote: In which case document's OnOpenDocument() method is used?
When you want to reinitialize the existing CDocument object, rather than create a new one.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I think you can do this in CChildView::OnCreate handler for WM_CREATE notification.
|
|
|
|
|
Hello,
how to sort an vector! is there any codesnippet or example for me? i try but my solution dont works!
This is what i try before:
<br />
typedef vector<CVector>VectorGlobal;<br />
VectorGlobal vec;<br />
<br />
while(int_value < 10)<br />
{<br />
vec.push_back(CVector(int_value, cstring_value, cstring_value));<br />
}<br />
<br />
VectorGlobal::iterator iter;<br />
<br />
for(iter = vec.begin(); iter != vec.end(); iter++)<br />
{<br />
TRACE(L"CSindex: %s, Url: %s\n", iter->csIndex, iter->csUrl);<br />
}<br />
sort(vec.begin(), &vec[vec.size()]);<br />
<br />
for(iter = vec.begin(); iter != vec.end(); iter++)<br />
{<br />
TRACE(L"CSindex: %s, Url: %s\n", iter->csIndex, iter->csUrl);<br />
}<br />
after i call the sort function the datas stay unsortet, where is the error, how to call the sortfunction für an vector?
regards
break;
-- modified at 10:24 Wednesday 21st June, 2006
|
|
|
|
|
|
break; wrote: sort(vec.begin(), &vec[vec.size()]);
?
try: sort(vec.begin(), vec.end());
but, more importantly, since you have a vector of CVector, what does your CVector comparison function look like ?
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
Hi,
thaks for answers, the CVector is maybe a wrong name, this is very simple class:
<br />
class CVector<br />
{<br />
public:<br />
CString csName;<br />
CString csLastName;<br />
UINT iIndex;<br />
}<br />
bool operator==(const CVector& x, const CVector& y)<br />
{<br />
return (x.csUrl == y.csUrl) && (x.iIndex == y.iIndex);<br />
}<br />
<br />
bool operator<(const CVector& x, const CVector& y)<br />
{<br />
return x.iIndex < y.iIndex;<br />
}<br />
and the compare functions are global, this sample is from the MSDN!!
break;
-- modified at 10:31 Wednesday 21st June, 2006
|
|
|
|
|
if i run your code (with minor adjustments to make it compile - and fill with random data), it works fine - they are sorted by index:
class CVector
{
public:
CString csIndex;
CString csUrl;
UINT iIndex;
CVector(int i, char *a, char *b)
{
iIndex = i;
csIndex = a;
csUrl = b;
}
};
bool operator==(const CVector& x, const CVector& y)
{
return (x.csUrl == y.csUrl) && (x.iIndex == y.iIndex);
}
bool operator<(const CVector& x, const CVector& y)
{
return x.iIndex < y.iIndex;
}
.... main
typedef vector < CVector > VectorGlobal;
VectorGlobal vec;
int int_value = 0;
while(int_value < 10)
{
char a[2];
a[0] = 'a' + (rand() % 26);
char b[2];
b[0]= 'A' + (rand() % 26);
a[1]=b[1]=0;
vec.push_back(CVector(rand() % 40, a, b));
int_value++;
}
VectorGlobal::iterator iter;
for(iter = vec.begin(); iter != vec.end(); iter++)
{
TRACE("CSindex: %s, Url: %s Idx: %d\n", iter->csIndex, iter->csUrl, iter->iIndex);
}
sort(vec.begin(), vec.end());
for(iter = vec.begin(); iter != vec.end(); iter++)
{
TRACE("CSindex: %s, Url: %s Idx: %d\n", iter->csIndex, iter->csUrl, iter->iIndex);
}
output:
CSindex: p, Url: H Idx: 14
CSindex: g, Url: H Idx: 4
CSindex: m, Url: E Idx: 2
CSindex: y, Url: L Idx: 25
CSindex: l, Url: F Idx: 1
CSindex: x, Url: F Idx: 22
CSindex: r, Url: C Idx: 31
CSindex: s, Url: C Idx: 33
CSindex: g, Url: G Idx: 21
CSindex: w, Url: K Idx: 15
CSindex: l, Url: F Idx: 1
CSindex: m, Url: E Idx: 2
CSindex: g, Url: H Idx: 4
CSindex: p, Url: H Idx: 14
CSindex: w, Url: K Idx: 15
CSindex: g, Url: G Idx: 21
CSindex: x, Url: F Idx: 22
CSindex: y, Url: L Idx: 25
CSindex: r, Url: C Idx: 31
CSindex: s, Url: C Idx: 33
Cleek | Image Toolkits | Thumbnail maker
-- modified at 10:48 Wednesday 21st June, 2006
|
|
|
|
|
Hi Chris,
thanx for answer, i try the same, but take no efect!
break;
|
|
|
|
|
Try this:
class CVector<br />
{<br />
bool operator< (const CVector& that)<br />
{<br />
return this.data < that.data;<br />
}<br />
};<br />
<br />
typedef vector<CVector> VectorGlobal;<br />
VectorGlobal vec;<br />
<br />
while(int_value < 10)<br />
{<br />
vec.push_back(CVector(int_value, cstring_value, cstring_value));<br />
}<br />
<br />
void print(const CVector& v)<br />
{<br />
TRACE(L"CSindex: %s, Url: %s\n", v.csIndex, v.csUrl);<br />
}<br />
<br />
for_each(vec.begin(), vec.end(), print);<br />
sort(vec.begin(), vec.end());<br />
for_each(vec.begin(), vec.end(), print);
As a side note, use STL algorithms instead of custom loops whenever possible (which is almost always).
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hello,
this is my class CVector, i change the operator funkctions to:
<br />
class CVector
{<br />
public:<br />
CString csName;<br />
CString csIndex;<br />
UINT iIndex;<br />
public:<br />
<br />
CVector()<br />
{<br />
<br />
csIndex = L"";<br />
csName = L""; <br />
iIndex = 0;<br />
}<br />
CVector(UINT index,CString csindex, CString csname,...)<br />
{<br />
iIndex = index;<br />
csIndex = csindex;<br />
csName= csname;<br />
} <br />
<br />
<br />
bool operator==(const CVector& y)<br />
{<br />
<br />
return (csUrl == y.csUrl) && (iIndex == y.iIndex);<br />
}<br />
<br />
<br />
bool operator<(const CVector& y)<br />
{<br />
return iIndex < y.iIndex;<br />
}<br />
<br />
};<br />
i try now to finish with your sample!
regards
break;
-- modified at 10:40 Wednesday 21st June, 2006
|
|
|
|
|
|
If it's not a vector of a built-in type, should you use this format of sort():
std::sort(vec.begin(), vec.end(), CompareFunction(vec)); where CompareFunction() is defined by you based on your vector type.
Check out this CP article.
Best,
Jun
|
|
|
|
|
Hello comunity,
thanx a lot for help, i solve the problem, it works!
regards
break;
|
|
|
|
|
I am in need for reading huge files (*.txt, *.dbf, *.csv) of around 4+ gb and displaying the contents of
the file page by page. Application also requires to display scrolling data. Functions like ShowLongestString() which would search entire file and display the string.
The current method of reading the files is very slow(using CFile). I have two options to improve the performance.
1) Using CMemFile.
2) Reading the file in chunks at a time and displaying the same. But I wonder how would ShowLongestString() functions perform. Also if the file is in a network it might make the overall system slower for every chunk of data read.
I am confused into wich way to go. Or of there is any better way. Any help with this will be very much appreciated.
Thanks and Regards,
Arti Gujare
-- modified at 10:01 Wednesday 21st June, 2006
|
|
|
|
|
Also please note that I read the whole file into a memory buffer and so its a slow one time read operation.
I have not used CMemfile before. So I am not sure whether CMemfile will satisfy all the app requirements.
|
|
|
|
|