|
Hmmm, it the 2.8GHz hyperthreaded?
Then it runs the program a lot like a dual-cpu computer will do it. And trust me, you will find the strangest threading errors on dual-cpu computers...
If this is the case, you might have some sort of thread deadlock in yout program.
- Anders
Money talks, but all mine ever says is "Goodbye!"
ShotKeeper, my Photo Album / Organizer Application[^]
My Photos[^]
New developersite: RealDevs.Net
|
|
|
|
|
Aragorn@Gondor wrote:
The Encoder is very heavy COM object, and so I created a separate thread for it.
Has the thread joined the apartment, or is it running in its own MTA? I wish I had the COM book by the Don Box guru with me right now. I recall reading about calls across apartment boundaries may hang. Gah, how frustrating! I can't remember the scenario in which it could occur.
But anyway, perhaps you could google for don box apartment hangs rpc. I'm sorry I couldn't be of much more help.
And yeah, you may want to post this in the COM forum. I bet it's related to COM in some way.
--
Ich bin Joachim von Hassel, und ich bin Pilot der Bundeswehr.
Welle: Erdball - F104-G Starfighter
|
|
|
|
|
Here is the code:
#pragma once
class Model
{
public:
Model(void);
~Model(void);
private:
std::vector<std::pair<AcGeLineSeg2d, double> > lines;
};
I am using Visual Studio 2003.
The main problem is that I'll add #include <utility> and instantly I have 30 or more errors. Even more fascinating, if I remove #include <utility> it still gives those same messages! It would be nice if I could get it to compile "std::vector<std::pair<AcGeLineSeg2d, double> > lines;" without an error. It gives error C2143: syntax error : missing ';' before '<'.
Thanks for your consideration,
Sean
|
|
|
|
|
Did you try to #include "vector" ?
|
|
|
|
|
Yes I had tried that- I've tried a lot of things. That works for getting rid of compile errors on that particular line, but does nothing with the xutility errors...
|
|
|
|
|
Could you please post operators definitions here if you have any?
[UPDATE]
I meant your AcGeLineSeg2d of course.
|
|
|
|
|
There aren't any operators defined.
In fact, my code is as simple as it gets. What is even weirder is that the xutility errors showed up in a new project that doesn't even use pair or even any header files, aside from #include "vector" (which should really be "class vector;", but that is something altogether different).
|
|
|
|
|
Wait a second...
You're using STL right? So you have to include STL classes headers (like include "vector", cuz vector is a member of STL) and suggested forward declaration "class vector" will give you nothing but an error. What to xutility error, check your code carefully for dummy errors. All I've ever got from xutility is some warnings.
|
|
|
|
|
With very little work, I got the code to work in 6.0. For that reason, I will momentarily stop using .NET 2003 until absolutely necessary.
Thanks for your time!
Sean
|
|
|
|
|
Hi there,
I have this problem with two classes which need to access each other's methods. Allow me to exemplify:
<br />
class CBaseClass<br />
{<br />
public:<br />
CDerivedClass *pDerived;<br />
.<br />
:<br />
.<br />
};<br />
<br />
class CDerivedClass<br />
{<br />
public:<br />
CDerivedClass()<br />
{<br />
CBaseClass *pBaseClass;<br />
.<br />
:<br />
.<br />
};<br />
.<br />
:<br />
.<br />
};<br />
Now, as you may have guessed by now, I can't compile this as the compiler doesn't recognise CDerivedClass (it is declared after CBaseClass...).
I know this can be solved -- I just don't know how. Could you please give me a hand?
That would be much appreciated.
David
|
|
|
|
|
Use a declaration or move the CDerivedClass definition above CBaseClass'.
Example:
class CDerivedClass;<DIV>
class CBaseClass
{
public:
CDerivedClass* pDerived;
.
.
. This works. It's the same thing as using function declarations, e.g. header files, etc.. If you forget to write the CDerivedClass definition now, you'll get a linker error.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Thanks Antti, once again.
I did exactly like you said (which is very logical, now that I think about it), but it isn't working yet. This time I get different compiling errors:
m:\~alibrary\projects\vc++\xig1\v2.0\xig1view.h(27) : error C2027: use of undefined type 'CXiG1View'<br />
m:\~alibrary\projects\vc++\xig1\v2.0\xig1view.h(15) : see declaration of 'CXiG1View'<br />
m:\~alibrary\projects\vc++\xig1\v2.0\xig1view.h(27) : error C2065: 'classCXiG1View' : undeclared identifier<br />
m:\~alibrary\projects\vc++\xig1\v2.0\xig1view.h(35) : error C2027: use of undefined type 'CXiG1View'<br />
m:\~alibrary\projects\vc++\xig1\v2.0\xig1view.h(15) : see declaration of 'CXiG1View'<br />
m:\~alibrary\projects\vc++\xig1\v2.0\xig1view.h(35) : error C2227: left of '->pConsole' must point to class/struct/union<br />
m:\~alibrary\projects\vc++\xig1\v2.0\xig1view.h(35) : error C2227: left of '->Output' must point to class/struct/union
By the way:
CXiGView is a CFormView (and has a CPrompt object)
CPrompt is declared before CXiG1View (and is a custom control derived class)
I declared the classes in the following way now:
class CXiG1View;
class CPrompt : public CXCommandPrompt
{
public:
CPrompt()
{
CWnd *pParent;
.
:
.
};
class CXiG1View : public CFormView
{
.
:
.
What am I missing out here?
|
|
|
|
|
There seems to be nothing wrong with the declaration you posted. Perhaps there's a typo or a syntax error (missing semicolon or something) somewhere else in your file ? I would check the lines that the compiler is suggesting, and the lines above/below them for typos/errors.
Unfortunately I can't find the error for you, you just need to go through the file with a magnifying glass.
To avoid similar problems in the future, I would suggest you (or your company, whichever) to familiarize yourselves with the excellent "Visual Assist X" tool from Whole Tomato Software. It simplifies and helps coding. And A LOT that is
For a quick link, go here.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Thanks for all your help Antti! You have really been very helpful.
You can't imagine how tired I am; I'm having memory blocks [or loss, I don't know anymore!] due to the excessively coffee drank till now. I have been up for 21 hours now, non stop, working on this [new] project that just came up and, to complicate things even more, i've done MFC programming for only a month -- we're short on staff.
But thanks to you I have managed to finally put up all the pieces together (the custom controls I have been working on) and link/attach them to the CFormView-derived class.
Finally! Thank you very much Antti; I can finally go to bed (with some valuable lessons learned on the way -- hmm not too bad! )
David
PS: That tool you've mentioned before seems to be very interesting -- am going to give it a try tomorrow.
|
|
|
|
|
Hello,
I have been working on a project that interops between C# in .NET and unmanaged C++. Here's the jist: my main is in C++, and in it, i create an instance of an object made in C#. The C# is supposed to connect to the database, sort through the results and put the information into a bunch of arrays which are sent back to the C++ porition. While i got the two projects to connect and communicate somewhat, I am now having some issues with datatypes...or so i think.
Here's what i've got in C++:
...
double vd[100];
int vi[100];
string vs[100];
//send arrays to Read() method in C#
spConnNET->Read(vi, vd, vs);
The Read() method in C# looks like this:
...
public void Read(int[] intArray, double[] doubleArray, string[] stringArray)
{
while(reader.NextResult())
{
//THere will be other stuff here
reader.Read();
}
}//end Read()
when i try to compile in C++, this is the error i'm getting:
error C2664: 'DBConnection3::IConnection::Read' : cannot convert parameter 1 from 'int [100]' to 'SAFEARRAY *'
"SAFEARRAY"??!?! what the heck is that?? I thought it was "int, double, string"??
EDIT: I have tried looking up SAFEARRAY and whether it can be converted into an int/double/string and vice versa, but I don't fundamentally understand why this type conversion is taking place, what it means, what can be done...etc...
my apologies in advance for my newbie-ness...I would really appreciate some advice!
|
|
|
|
|
What is the fastest way to find whether a given file exists in my hard disk (any drive). I have only file name. It can be in any folder.
Thanks in advance.
|
|
|
|
|
|
|
This is evil. Are you sure you can't get a path, or at least some restrictions on where the file can be? Can you rethink the design? Sometimes you have to do something evil, but you should seriously consider if there is some other option before doing this.
I think you have to search every direcotry, one at a time, which as you can guess is not fast. Standard visit every node in a tree algorithm, see any textbook. Filesystems do not normally catch all the filenames on disk. (some will cache directory trees)
If you are getting data for a specific a user, then you should restrict your search to "My Documents" for that user, which will be much faster. (but you still need to look on floppys, USB keys, and other devices, or at least make is possible)
You might also be able to store something in the registry.
|
|
|
|
|
After a night of sleep I recalled that on unix there is often two command line tools that do this: locate and find. Locate builds a database (generally once a week), and searches the database (fast, but it won't find files after the last datebase update), and find searches the filesystem.
Either might be a starting place for what you want. (though others have since posted methods that I did not recall existing...) In particular locate might be better if you expect to do this often and can live with sometimes missing files created since the last database rebuild. FreeBSD might have BSD versions that you could copy. (but check, they might just use a GPL version)
|
|
|
|
|
|
Take a look at _taccess or _access in MSDN.
|
|
|
|
|
If your program will run on a system with IIS and some other widgets installed, you might be able to look into querying the indexing service.
See the MDSN topic "Indexing Service"
|
|
|
|
|
Hai,
Thanks a lot.I have another question.
in win32 I'm using GetDC() for drawing.For some reason I could'nt use WM_PAINT.
Now what happens is that my drawing gets erased when another window moves over or when I minimise or move my window.Can anyone suggest?
Thanks again in advance.
|
|
|
|
|
You need to redraw after all those situations (covering, minimizing etc..).. Why couldn't you use your drawing routine in the WM_PAINT handler?
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|