|
I'm afraid it's quite a few years since I used VC 6, and it was quite different in many ways from the Visual Studio versions. However, you should be able to check and see all the various items by using the Project -> Properties link in the solution explorer.
Use the best guess
|
|
|
|
|
Yes, and I think I also remember that the command lines (or at least the parameters for the current settings) for the compiler and the linker were shown in the property window.
Sent from my BatComputer via HAL 9000 and M5
|
|
|
|
|
Yes, I think it was the last item in the property tree for each command, same as the more modern versions.
Use the best guess
|
|
|
|
|
Vaclav_Sal wrote: I think I got the basics, but would like to know how compiler applies stuff like “dependencies” , settings – preprocessor “additional includes” and “Options – directories”.
The phases of translation during program compile are described here[^].
Information about #pragma is compiler specific. The info for Visual Studio can be found here[^].
--
Harvey
|
|
|
|
|
Thanks, very good link. Appreciate that.
|
|
|
|
|
Vaclav_Sal wrote: It seems that one of the major obstacles in developing a real application is lack of understanding of one of the fundamental language features – in this case C preprocessor.
That isn't true.
Vaclav_Sal wrote: I am sure this can be applied to any C derivative - C++, C# and other languages.
It doesn't apply in the same way to C# as it does to C/C++.
Vaclav_Sal wrote: I think I got the basics, but would like to know how compiler applies stuff like “dependencies” , settings – preprocessor “additional includes” and “Options – directories”.
I suspect you are confusing how '#include' resolves stuff versus how similar looking but substantially different idioms work in C#.
Vaclav_Sal wrote: I am currently using it to stop the compiler when there are too many initial error.
Eventually you should stop doing that.
|
|
|
|
|
Not what I really expected, but if I added "MY lack of understanding" you would probably get little more personall with your response.
I am not confusing anything with C# since I don't use it.
And don't tell me not to use #error - it does what I want, so what if it is not "cool".
ANyway, thanks for your response.
|
|
|
|
|
Vaclav_Sal wrote: I am not confusing anything with C# since I don't use it.
You said "...C# and other languages" so I presumed that C# was in fact relevant.
Vaclav_Sal wrote: And don't tell me not to use #error - it does what I want, so what if it is not
"cool".
Your presumption about my reasoning is incorrect. Your stated usage is incorrect because with more experience the way in which you deal with compilation units, regardless of language, will change. And thus your current idiom will be less useful and can in fact interfer with correctly determining problems.
|
|
|
|
|
Vaclav_Sal wrote: lack of understanding of one of the fundamental language features – in this case C preprocessor
There isn't much to understand:
1. don't use #define if you can help it
2. #include simply inserts the text of the listed file at that position. This has some implications as to what you should and shouldn't put in there, but that is really all there is to know.
3. #pragma commands depend on the compiler
Vaclav_Sal wrote: I think I got the basics
If you mean by "real application" a program consisting of two or more files, then yes, you need to understand how includes work. IMHO you haven't got the basics until you understand at least that much. Maybe the typical introductory programs (like "hello world") should use a custom include file just to point out the importance of this technique in C/C++ ...
As for the other settings you mentioned, these are mostly irrelevant for understanding the preprocessor functionality. Also they're specific to VS/VC, not the C/C++ language in general. Each compiler and IDE use these differently, so you should learn about these settings by reading them up in the compiler documentation.
|
|
|
|
|
Stefan,
thanks for reply. I find your objection to using #define peculiar.
For example – the basic MFC wouldn’t fly without it. The first C program I wrote over 30 years ago I used #define MAX 256 to have a single place in the program where the value of MAX can be changed. And how about #define DEBUG?
I think stating that #include just adds the file text is rather simplistic. I was actually looking to discuss experiences / preferences in putting include in various places of application. In VC6.0 you can put “include “ in Project Settings, in Tools Option in an addition to files. I am sure newer IDE's have similar options.
I just went thru couple of sleepless nights trying to find linker error – cannot find file “g:.lib”.
Simple search just did not work this time.
Well I had a #pragma comment referring to a wrong directory. So my experience with VC6.0 #pragma - it works but is not that user friendly.
Cheers Vaclav
|
|
|
|
|
I did say "if you can help it", and the implied advice was that you should avoid #define, if there is a better method. There are better methods for every single example you gave:
1. #define DEBUG
This is used for conditional compilation, to add more code that helps your debugging. Normally such a define should not be right in your code, as it specifies which path to use for compilation and which to ignore. Instead you sheould set that in your compiler options, or directly pass it as a command line argument to your compiler (something like "-D DEBUG")
Maybe what you meant was code enclosed in #ifdef DEBUG ... #endif - but I have no qualms with that.
2.#define MAX 256
Since Ansi C, you should use this syntax instead:
const int MAX=256;
3.#define max(a,b) (a < b ? b : a)
With C++ templates, you should better use this instead:
template <class T>
T max(const T& value1, const T& value3) {
return (value1 < value2) ? value2 : value1;
}
On a sidenote, since you mention MFC, the windows header files contain a min and max macro just like that listed above. And you don't even have to write some clever code to make it crash: just include valarray (a STL class header) in your windows application, instantiate a valarray variable and try to compile that!
You mention how you wrote code 30 years ago, and how MFC uses #define a lot. Please think about the implications: Yes, MFC used #define a lot 30 years ago, just like you did. But that doesn't mean that this is still recommended üpractice today!
Vaclav_Sal wrote: I think stating that #include just adds the file text is rather simplistic.
To the contrary, it is very concise. You are mixing up include options that you can enter in the project and compiler settings with the include statements in your code. These options will only tell the compiler which directories to search or skip when looking for an include file.
|
|
|
|
|
Hello friends
I am using Owner Draw menuItem Icons in MFC application. Now, when I Run it in release build,menus are displaying fine But in Debug Build,MenuItem are large in size that covering full screen.
Any IDeas ?
Regards
Y
|
|
|
|
|
yogeshs wrote: Any IDeas ? You have a bug in your program. Unless you provide some proper detail information it is impossible to guess; we have no idea what your code is doing.
Use the best guess
|
|
|
|
|
hello Sir
I know that I didn't Post any Code and asking for Ideas. am Sorry for that.
But I found tht in Fn Onmeasureitem ,we are using drawText to get height of Text which is returning wrong [>1] in debug build and 1 in rlease build.
CWindowDC dc(NULL); CRect rcText(0,0,0,0);
CFont* pOldFont = dc.SelectObject(GetMenuFont());
dc.DrawText(pmd->text, rcText, DT_MYSTANDARD|DT_CALCRECT);
CSize size = dc.GetTextExtent(pmd->text);
dc.SelectObject(pOldFont);
lpms->itemHeight= max(GetSystemMetrics(SM_CYMENU), rcText.Height()+1);
int cx = rcText.Width(); cx += CXTEXTMARGIN<<1; cx += CXGAP; cx += m_szButton.cx<<1;
cx -= GetSystemMetrics(SM_CXMENUCHECK)-1;
lpms->itemWidth = cx;
Now, Any Ideas. m compiling it on VS 2010.
Regards
Y
|
|
|
|
|
yogeshs wrote: Now, Any Ideas. Sorry, no. I can only suggest you use your debugger to check all the parameters and their values as you step through the code to see if any one or more value(s) may be incorrect.
Use the best guess
|
|
|
|
|
Hi, i was able to detect finger tips and valleys using cvConvexityDefects() and Convexhull functions...now i want to identify what finger tip is belongs to what finger...for an example i want to detect finger tip of the thumb and do something..Need some tips...Thanks in advance 
|
|
|
|
|
I would venture that you need to identify the entire hand contour and get the individual fingers.
I think you need to find the skeleton – I think is is called erosion.
Take a look at OpenCV for contour function.
Vaclav
|
|
|
|
|
hi,thnx for the rply..i used cvFindCountours() function to get the contours of the hand..i will try the skeleton one as ypu suggested..but i want to know how to use depth value of convexitydefects to identify fingers...Thank you
|
|
|
|
|
hi,thnx for the rply..i used cvFindCountours() function to get the contours of the hand..i will try the skeleton one as you suggested..but i want to know how to use depth value of convexitydefects to identify fingers...Thank you
|
|
|
|
|
These days ,i read the source code of cocos2d-x . When i read the CCApplication class of win32 platform , in the function run of CCApplication ,there is a function :
static void PVRFrameEnableControlWindow(bool bEnable)
{
HKEY hKey = 0;
if(ERROR_SUCCESS != RegCreateKeyExW(HKEY_CURRENT_USER,
L"Software\\Imagination Technologies\\PVRVFRame\\STARTUP\\",
0,
0,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,
0,
&hKey,
NULL))
{
return;
}
const WCHAR* wszValue = L"hide_gui";
const WCHAR* wszNewData = (bEnable) ? L"NO" : L"YES";
WCHAR wszOldData[256] = {0};
DWORD dwSize = sizeof(wszOldData);
LSTATUS status = RegQueryValueExW(hKey, wszValue, 0, NULL, (LPBYTE)wszOldData, &dwSize);
if (ERROR_FILE_NOT_FOUND == status || (ERROR_SUCCESS == status && 0 != wcscmp(wszNewData, wszOldData))) {
dwSize = sizeof(WCHAR) * (wcslen(wszNewData) + 1);
RegSetValueEx(hKey, wszValue, 0, REG_SZ, (const BYTE *)wszNewData, dwSize);
}
RegCloseKey(hKey);
}
i do not understand the key value "hide_gui" .What can it do to effect my app ?
I am a new learner in C++ and i am not a english speaker , so if you do not understand my meaning ,i am very sorry for that .
|
|
|
|
|
You need to contact Imagination Technologies about this, it's their software. However, the code above sets its value to "NO" or "YES" , according to whether bEnable is true or not.
Use the best guess
|
|
|
|
|
Dear Friends,
I want to design function using C++. Like this
int GetValue(CString VariName );
I will pass Variable name as a String into function and function should return value of the variable.
struct StudentInfo
{
int rollnum;
int mark1;
int mark2;
} *stud;
int GetVal( _T("Stud->rollnum")); // Now function should return the value of Stud->rollnum
Friends help me...
Thanks and Regards,
S.Shanmuga Raja
|
|
|
|
|
Answer is apart. Why you want to do it Like that?
|
|
|
|
|
C/C++ has no built-in mechanism to do that.
you will have to come up with some kind of data structure which maps a string to a variable. maybe put the variable name in the structure itself, then search your collection of structs to find the one you want. or, create a std::map which uses a string (var name) as the key and a struct as the value. or... there are lots of options - none of them are great.
|
|
|
|
|
If you want to use c++ make a class instead of struct:
class CStudentInfo
{
public:
enum EVal
{
erollnumEVal,
emark1EVal,
emark2EVal
};
int GetValue( EVal eVal )
{
int iRetVal = 0;
switch( eVal )
{
case erollnumEVal:
iRetVal = rollnum;
break;
case emark1EVal:
iRetVal = mark1;
break;
case emark2EVal:
iRetVal = mark2;
break;
default:
ASSERT( FALSE );
break;
}
return iRetVal;
}
private:
int rollnum;
int mark1;
int mark2;
}
But why do you need something like this?
couldn't it be just simple:
class CStudentInfo
{
public:
int Getrollnum()
{
return rollnum;
}
int Getmark1()
{
return mark1;
}
int Getmark2()
{
return mark2;
}
private:
int rollnum;
int mark1;
int mark2;
}
|
|
|
|