|
xbottle wrote: In my code ,it’s a thread code.
At this stage of the game, you should not be doing any multithreading. That's an intermediate/advanced topic.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
xbottle wrote: memcpy(s,"hello",512);
What exactly are you expecting this to do? After it copies the 6 characters from the string literal, its going to copy 506 more characters from elsewhere. Is that intentional?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I have been programming for about 3 years. I found that if I try to speedup the program, it often entails more expense of memory. And for a particular algorithm, if more thresholds, predicates and parameters which needs users to tweak manually, the program implementing this algorithm tends to run faster.
In this sense, all programs if designed according to the common practise, even it is always on the edge of the same kind. Optimization is trivial modifications and equivalent to shifting the fulcrum of lever from time to memory or reversely, also the support of the lever of presumption to automation.
Thus, we cannot attain the savings of time and space at the same time. Why don't just choose one end and assent with one program or one algorithm for a particular problem? Why bother trouble to reproduce so many programs with approximately the same behavior taking both time and memory into account?
|
|
|
|
|
If i understand you correctly you are wondered why a program optimized for speed uses more memory and a program optimized for size is mostly slower.
I think there are 3 ways to optimize a program:
1. Get rid of all unneeded code. Classic examples are:
- the programmer lost oversight of variables resulting in several variables holding the same value
- He's insecure what value is in a variable resulting in too many conditions asking the same question
- Using the wrong algorithm to solve a problem
This kind of optimizing is for free: you will end with a program that uses less memory and less CPU
2. If your program does not contain any unneeded code, the only thing left is trade between memory, CPU and time. Your program says: i need this number of sourcode lines to solve the problem. Thus you only can restate lines, change computation into memory usage. This kind of optimizing has its costs: less CPU is more memory and v.v.
3. Sometimes you can divide a CPU-consuming piece in several parts that can be done when the program waits for the user. This kind of optimizing essentially does nothing (it still consumes the same time) but changes the feeling of the user. (actually you are not manipulating the program but the user).
I think a more interresting question would be: how can you garantuee that your program does not contain any needless code....
Rozis
|
|
|
|
|
Thank you very much for your explanation! I am clearer now.
|
|
|
|
|
I create a small class as following:
class NP
{
public:
int a;
int b;
NP(int m=3, int n=5):a(m),b(n){}
~NP(){}
operator<(const NP&d)//I added this two lines manually
{return a<d.a;}
};
In the tab area of class view, I can see class NP. If I try to overload operator< for class NP through the add member function in the pop-up menu, after I filled all the blanks in the add member function dialog box, when I click OK, nothing happens. What happened?
|
|
|
|
|
I tried this and it works well.
Give the function name as operator < .
Then give the parameter type as you want it and a name for the parameter.
The return value can be anything. You can manually delete it later.
If it still doesn't work try deleting the intermediate files and other .ncb files and try.
|
|
|
|
|
I don't find anything wrong with the code expect a point noted that you didn't specify the return type of operator <.
Well i usually do this stuff with a friend function
friend int operator<(const NP& left, const NP& right )
{
return left.a<right.a;
}
Величие не Бога может быть недооценена.
|
|
|
|
|
code to convert CString to const char *
using UNICODE in application. so first I need to convert it to ANSI.
anyone having working code.
Future Lies in Present.
Manmohan Bishnoi
|
|
|
|
|
See here and here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Use macro "CT2A()" or "CW2A()"
|
|
|
|
|
|
Firstly if you are using wide char (Unicode)then CString will be of Type CStringW by default and thus all us need to do is if u have :
CString str;
// do the following
CW2A(str); // this will give u const char*
else if its Multibyte charset project CString will be of type CStringA by default:
// u can directly cast it to char* as below:
CString str;
//do the following
(CHAR*)str.GetString();// this will give u Const char*
If you like this ans mark it and close the thread
Regards
Kushagra
|
|
|
|
|
Hi all,
I am new to opencv and I want to use it. But Before the application starts an error appears:
"The application was unable to start correctly (0x0150002).Click OK to close the application"
Please help me(I am using opencv2.0 and running windows vista)
Thanks.
Every new thing you learn,Gives you a new personality.
|
|
|
|
|
dSolariuM wrote: But Before the application starts...
What application?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi, thanks for quick reply...
I mean my application (.exe) file. after i press F5 button to debug the error appears.
Every new thing you learn,Gives you a new personality.
|
|
|
|
|
Have you narrowed the problem down to OpenCV? In other words, what happens if you cerate a new project that does not use OpenCV?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I have the problem with opencv only... I have included all the files and libraries...
Then I write a simple code that uses opencv libraries... Then I debug the app and the error appears... Before even clicking on the button that contains the code...
Every new thing you learn,Gives you a new personality.
|
|
|
|
|
Are you implicitly or explicitly linking with their libraries? Have any global OpenCV-related objects been declared?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I have global declarations of opencv classes and I am using "additional dependencies" section in Linker options.
Every new thing you learn,Gives you a new personality.
|
|
|
|
|
dSolariuM wrote: I have global declarations of opencv classes...
Classes or objects? Global objects will be instantiated before your "main" function gets called. That may be where the error is happening.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Basic question. I assume you managed to build the OpenCV libraries and/or DLLs successfully? Also, do you know about the OpenCV support group on Yahoo Groups? You may have better luck there since it's a specialized support group.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
i have the same problem...did you find any solution?
/David
|
|
|
|
|
I am facing same problem.. Has any body found solution for same
|
|
|
|
|
hi, maybe already is late, but like aditional information, i got the same problem and i solved, a had put cv210d.lib; cvauxd.lib; etc. in the entry of Link in properties window, I erased the letter 'd' cv210.lib; cvaux.lib; etc. and the message "The application was unable to start correctly (0x0150002)" no appeared other time.
Regards.
|
|
|
|