|
I modified the message so that the message board wouldnt parse the < > symbols out of the code, so here is the intended version I wanted to post... It should make more sense now, another note I am not using the algorithm header to do this, only the vector header, also worth mentioning is that passing should not be affected by the version of the header I am using, its a vector so its part of the STL.
"Your KungFu is not strong enough"
|
|
|
|
|
Magadass wrote: error C2784: 'bool std::operator ==(const std::vector<_Ty,_Alloc> &,const std::vector<_Ty,_Alloc> &)' : could not deduce template argument for 'const std::vector<_Ty,_Alloc> &' from 'const int' c:\program files\microsoft visual studio 8\vc\include\algorithm 40
Read the error message you posted. It tells you what the error is and the file and line number that the error occured on. The file is 'algorithm' and the line number is 40. The error occurs when the function calls std::operator ==(). Figure out what function is at line 40, then where you call that function. The error is probably in the parameters you pass to that function. The code you posted so far seems OK to me.
Also, have you looked up C2784 in MSDN? There is usually an explanation and possible solution listed there.
"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!
|
|
|
|
|
It is referring to an error created in the STL because I am passing the argument incorrectly. That is why I need clarification on how to pass a Multidimensional array by reference, the debugger is trying to tell me that there is an error in the STL, which obviously there isnt, it even takes me to that STL library when I click the error.
The probel I am trying to solve which is the root of this problem is my failure to know how to setup the syntax correctly. I posted the error incase anyone else had the problem and would notice it, but in reality it is not directly associated with the problem I am having...
"Your KungFu is not strong enough"
|
|
|
|
|
Nevermind PJ my appologies, you ever debug something over and over and over and over and cant figure out whats wrong yet its right in front of your face?
So yeah I was using find in a totally seperate piece of my code, and this is what it was referring to but I thought it was referring to my declaration...soooo yeah you were right i was wrong...
Thanks!
"Your KungFu is not strong enough"
|
|
|
|
|
Magadass wrote: you ever debug something over and over and over and over and cant figure out whats wrong yet its right in front of your face?
Yeah, been there, done that!
Magadass wrote: Thanks!
You're welcome.
"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!
|
|
|
|
|
I am having problem to find and select an item in a ListView
::SendMessage(hWnd, LVM_FINDITEM, -1, (LPARAM)"item to find");
am I doing something wrong?
|
|
|
|
|
The LPARAM has to be the address of a LVFINDINFO structure, not a text string.
"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!
|
|
|
|
|
any code that explain how?
|
|
|
|
|
LVFINDINFO FindInfo = {0};
FindInfo.flags = LVFI_STRING;
FindInfo.psz = "item to find";
Index = ::SendMessage(hWnd, LVM_FINDITEM, -1, &FindInfo);
"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!
|
|
|
|
|
i will try and let you know, thanks alot
|
|
|
|
|
Hello guys,
I have a question : Is CWnd::SetTimer machine dependant ?
I am asking this question , because I have noticed that , for example a program which is using this function as a timer shows different delays in times on different PC - s.
On machines with faster processors a program using this method needs less time then on machines with slower processors.
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
|
|
|
|
|
The short answer is no. But to expound, it depends mostly on the load of the OS at that time. The timer won't fire untill the app (or thread) in question gets scheduled, or, if the app/thread in question has a lot of outstanding messages in the queue. A high-priority app running could quite easily delay it, or having many apps/threads running will have the same effect. Also, as a tidbit, different versions of Windows used different values for scheduling the time-slices each app/thread gets.
--
Joel Lucsy
|
|
|
|
|
Windows is not a real-time OS, so all time dependant functions will vary depending on the load of the machine.
On the best case, the timer callback will fall close to what you set it to, but most of the time it will be a little after.
I don't think that a Timer will be called before its ellapsed time.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
You know Max I had once written a game "Snake" , like on any Nokia mobile phone and I used the CWnd::SetTimer function for implementing a timer where I was doing different operations(moving the snake,....)
But when I took this game to my friends PC he has much better PC then I do , It was impossible to play the game as the Snake started to move very fast , of course on my PC it was moving normally.
So my problem is that I need to implement a exact timer in my current project.And I am practically sure that CWnd::SetTimer won't work for that.
Any ideas how to do that
thanks
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
|
|
|
|
|
SetTimer and the WM_TIMER message are defined to have 10 millisecond resolution. Unfortunately, they are treated as least priority messages, and are handled only if there are no other messages pending. This means that the timer may trigger every 10 ms, or it might be 100 ms. As others have mentioned, system load affects WM_TIMER behavior as well.
You can measure much more accurate intervals using QueryPerformanceCounter() .
Software Zen: delete this;
|
|
|
|
|
you are right Giogi,
SetTimer is some Machine Dependent! it based on cpu,load on machine etc..
so as Mr. Gary has mentioned you can go for
BOOL QueryPerformanceCounter( LARGE_INTEGER *lpPerformanceCount
);
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
I'll do it Alok ,
thanks
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
|
|
|
|
|
I am attempting to adopt only new programming style so I have a question and would like opinions on it...
For debugging in console applications I have seen the following used quit often:
#define DEBUG 1
#define debug if (DEBUG) cout
Then to output debug messages I would do: debug << "Program initiating" << endl;
and so forth...
After which before release DEBUG is set to 0, is this still the modern way to go about doing this?
"Your KungFu is not strong enough"
|
|
|
|
|
I believe _DEBUG is defined when you do a debug build so this would allow you to control your trace statements between debug and release builds.
Elaine
The tigress is here
|
|
|
|
|
Hello,
This depends on your needs. If you're writing a time critical application, you may want to remove the debug messages from your application. If you're writing a service oriented application, you may want to write debug messages to a file or whatever.
I've a general debug (template) library which writes the debug messages wherever I want. I even don't have to write preprocessor statements in my code. I think that something similar is the way to go these days. simple tracing messages won't do anymore. The main reason for this is that you also want error information from release builds.
I think that you should experiment with different ways of saving debug output and write a simple conveniant library that fits your needs.
Hope this helps.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Dear all
In VC++ i'm able to initialise the structure member for int. But, for the below piece of code i'm getting compile time error.
struct one
{
CString name;
}two={"doubt"};
Please kindly suggest me a better way to solve this problem.
|
|
|
|
|
S.R.Sasi Kumar wrote: i'm getting compile time error.
What error? Is it C2552: 'two' : non-aggregates cannot be initialized with initializer list?
Only aggregate types can be initialized with an initializer list. Aggregate types are arrays, classes or structures that have:
- no constructors
- no private or protected members
- no base classes
- no virtual functions
- no non-aggregate members
CString has constructors and protected members so it is a non-aggregate type. As struct one has a non-aggregate member, it is also a non-aggregate, so you get error C2552.
struct one
{
CString name;
} two;
two.name = "doubt";
"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!
|
|
|
|
|
One approach to solving this problem is to have a second struct that contains your initializers:
struct one {
CString name;
} two;
struct one_init {
LPCTSTR name;
} two_init = { "doubt" };
two.name = two_init.name; Of course, this makes a lot more sense when you are initializing an array, and the structure members are more complex.
Software Zen: delete this;
|
|
|
|
|
Dear sir
I followed the same syntax(both the option) and i'm getting the following error when i try to initialize the structure in VC++
struct one
{
CString name;
} two;
two.name="doubt";
and also
struct one
{
CString name;
} two;
struct one_init
{
LPCTSTR name;
} two_init = { "doubt" };
two.name = two_init.name;
1.syntax error : missing ';' before '.'
2.missing storage-class or type specifiers
3.two' : redefinition; different basic types
Please suggest me to rectify the mistake.
|
|
|
|
|
Dear friends,
I have declared a structure variable in common.cpp and i want to use the structure members in one.cpp as well as two.cpp. When i include the common.h in those two files, i am getting the "LINKER ERROR" saying
"struct COMMSETTINGS commparam" (?commparam@@3UCOMMSETTINGS@@A) already defined in DLMSView.obj
Please help me in solving this problem
|
|
|
|