|
Hi everyone!
I'm trying to learn stl, resisting the temptation to reinvent the wheel repeatedly, but I'm running into an initial problem.
typedef std::list<socket*> SOCKLIST;
function(SOCKLIST sockets_) {
SOCKLIST::iterator it;
for (it=sockets_.begin(); it<sockets_.end(); it++)="" {
...
}
}
this="" makes="" an="" error="" in="" the="" 'for="" (...'="" line.="" i="" think="" it="" doesn't="" like="" it<sockets_.end()="" statement.="" cryptic="" (to="" me)="" message="" follows:
bool="" __cdecl="" std::operator="" <(const="" class="" std::list<_ty,_a=""> &,const class std::list<_Ty,_A> &)' : could not deduce template argument for 'const class std::list<_Ty,_A> &' from 'class std::list
|
|
|
|
|
Ok sorry.
the < should be a !=
|
|
|
|
|
You are missing a type
typedef std::list<type> SOCKLIST;
where type can be int, char, string, a class, structure etc.
|
|
|
|
|
The forum ate my code. Since it probably ate your code to I'm not sure if this is the correct answer to your problem.
'typedef std::list<type> SOCKLIST;'
|
|
|
|
|
Yeah the forum ate my code. The type was, let's try to do this explicitly,
typedef std::list<Socket *> SOCKLIST;
but I fixed the problem, so it's OK. Thanks for the feedback!
|
|
|
|
|
Hi all,
I'd like to create the flat toolbar button effect using VC 5, can it be done? I know that this is a feature that wasn't added until VC 6, but doesn't the toolbar class just call COMMCTRL32.DLL anyway?
Under C++ Builder I recall being able to set new styles by overriding the window creation process, I assume this can be done with VC 5, I'm just not sure where? Also, VC 5 doesn't have the necessary defines, so I'd need the numbers as well. I think the necessary defines are CBRS_GRIPPER and TBSTYLE_FLAT, which I'd insert into the SetBarState(...) during creation of my FrameWnd???
Thanks
Jonathan
|
|
|
|
|
How can my program work in another computer without VC++ installed?
When i copy all the files from DEBUG directory and try to run the program in another computer, it always said missing some DLL files.......
How can I solve this problem??? I don't want to copy the DLL files everytime....
Thanks
|
|
|
|
|
go to Project / Settings / General / MFC and choose "Use MFC in a static library".
this will link all of the MFC and C-runtime stuff into your app so you won't have to distribute the DLLs.
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
I did!!!!! I did set it using static library....but still doesn't work...
Also, one of my another program works succesfully in another computer, but it cannot show some dialog box!!!!! What happened??? What is the procedure my copying the program to another computer??????
|
|
|
|
|
Which DLLs are reported as missing? If linking statically with the CRT doesn't solve it, you'll need to copy those DLLs over along with your app.
--Mike--
http://home.inreach.com/mdunn/
Sometimes, arming yourself with a big pointy stake just won't do you any good.
|
|
|
|
|
For example, MSVCRTD.DLL, MFC42D.DLL....
|
|
|
|
|
these are the MFC debug DLLs.
if your program is asking for these, then it looks like your program (or something it's linking with) is not statically linking to MFC.
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Try: Project>Settings and then select "Release" from the drop down combo box and again use the MFC in a statically linked library, this will make ur .exe file smaller. To compile goto Build>Batch build and check "Release" and click build. then goto the Release directory in your project and try that .exe file. Good luck, hope this helps....
Kun
|
|
|
|
|
First if you are going to distribute you application you need to compile it in release mode. The errors you are getting are because the debug version of those dlls are not on the target system, which they would not be if it is not a development machine.
Whether you statically link or dynamically link is up to you, however consider that statically linking increases the size of your redistributable.
If you are distributing this application the wrong thing to do is copy copy a folder, i.e. the debug folder. What you need to do is use an installation program such as Installshield or Wise. These tools help with such issues as registering COM components and ensuring the proper version of the required dlls on in place.
Second, ignore the advise given to you already.
|
|
|
|
|
I get an error "Unhandled exception at address 0x00000005" in my code. This function has already been called once when my program calls it again, and works fine the first time. The error line is on a simple assignment line:
iBytesReceived = 0;
Using the debugger to check the variable right before the assignment yields "CXX0069: Error: expression cannot be evaluated"
MSDN says this about error CXX0069:
"variable needs stack frame
The expression evaluator cannot evaluate the variable because it does not occur in a stack frame. This may be caused by variables declared as part of an inline function."
So, what the heck does all this crap mean
- John
|
|
|
|
|
Look at 'this', and see if it is NULL. It could be that you've tried to call a method in a pointer to a class that is NULL.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Hi,
I've developed a program that can display an array(16 elements) in graphic mode (just liked plotting a graph). The value of this array can be changed anytime, so I set a loop to keep checking the array and update the display. In this loop, I have to do some sorting, so there are so many for loops and if loop. These loops cause the display very very very very slow. However, these loops must be exist... how can i improve it?????
|
|
|
|
|
I'm no expert, but maybe if the sorting had its own thread it would solve your problem.
|
|
|
|
|
Yes using a seperate thread would give the appearance that the draw was being done more quickly. A means to check if updating is required before doing any sorting or drawing would also help.
Make sure you understand the issues involved with multi-threading before you attempt it.
These are professionals, please don't try this at home.;)
|
|
|
|
|
I know nothing about thread!!!!!!!! Can you give me some examples???????
Thank you!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
16 elements... should not be so slow!
I can't understand why you need a loop to check the array and how this could slow down drawing.
Check the array, sort the elements, then draw them. It should be easy!
As for the initial check, you may have a flag somewhere that you set when you update the array, thus you can avoid checking at all (if this is possible).
Paolo.
|
|
|
|
|
Are you 100% your sorting algorithm is the problem? Try commenting out the call to sort and see if that speeds up your program. sorting 16 elements shouldn't take any time at all.
|
|
|
|
|
You should do a couple of things.
1. Post some code so people can comment intelligently on what you are doing.
2. Put your array into a binary tree or sorted list, so that it remains sorted at all times.
3. If there are 'many' for loops, you're probably using bubble sort - if you use an STL container it is trivial to use a more efficient sort, not that this should matter for 16 elements ( although you don't say what they are. If they are large items and you sort by making deep copies, this could be the problem )
4. The most likely problem could well be your drawing code, but I cannot comment if I have not seen it.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
If i comment out the following codes, my display is much faster:
//Check Alpha Line first
for (int i=0; i
|
|
|
|
|
Hi,
I use CreateFile for use the Comport and LPT.
With Comport : I would like to know how data is in the InputBuffer ?
With LPTport : I would like to use Strobe, Init, Status, ...
and How can I do for read and write a data in PCICard ?
How can I do it ?
Best regards
youssef
|
|
|
|