|
Well, this is shooting in the dark, but I guess your desperation justifies desperate measures. Try (if you like) copying and pasting the whole CObjectCache definition in one of the offending .cpp , just above the class that uses it. This is not a fix, just a test to see how the compiler behaves.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquín M López Muñoz wrote:
Well, this is shooting in the dark, but I guess your desperation justifies desperate measures.
I shot, and it wasn't at all the problem, but it led me to it!!
I guess I don't quite understand templates yet... In the same way you add a forward declaration of a classA to a header file defining classB if a classB contains a pointer to classA (has-a), I had added a forward declaration of my template to one of the other header files.
When I copied the CObjectCache definition in front of the CFLAWDoc class, a bunch of things broke because of redefinitions... and in removing everything that caused the redefinitions, I came across that forward declaration.
Anyways, the forward is gone, the template definition is back to where it should be, and everything compiles and runs just fine.
Thank you sir. While you didn't actually find my problem, it probably would have taken me another day or two to find it without your suggestions.
Next time you're in Toronto, beers are on me.
J
|
|
|
|
|
Next time you're in Toronto, beers are on me.
Hey, glad to be helpful! Never been to Toronto, but came close a couple of years ago (tripped from Nova Scotia to Montreal, beautiful landscape).
The point you raised about forward declarations is interesting. As far a I know one can forward declare templates just like regular classes, and there's no VC++ bug about this feature that I know of. It'd be interesting to try to isolate this behavior in a tiny example (I'll might do it if I had some time spare), maybe you've hit a compiler bug.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Ok, here's something...
When I change it to a pointer member and change the CFLAWDoc constructor to "new" it, the compiler complains about 'CObjectCache<class CDataSlice>' : class has no constructors.
Now I've seen this before but only when the compiler has only seen a forward declaration and not the entire definition. Once again, I checked the preprocessor output and everything seems to be in place.
J
|
|
|
|
|
A shot in the dark ...
try putting typename in front of your CObjectCache variable declaration. If there is some confusion on the part of the compiler, maybe that will clear it up (or output a better error message).
CodeGuy
The WTL newsgroup: over 1300 members! Be a part of it. http://groups.yahoo.com/group/wtl
|
|
|
|
|
CodeGuy wrote:
try putting typename in front of your CObjectCache variable declaration. If there is some confusion on the part of the compiler, maybe that will clear it up (or output a better error message).
Not sure what you mean really. I can't put it in front of the type in the allocation statement:
m_pCache = new typename CObjectCache<CDataslice>(2000);
because typename is only allowed inside a template. And it doesn't seem to do anything except provide an alias for a type inside the template.
J
|
|
|
|
|
Have you tried renaming the class ? I've had different problems in the past where I found my core problem was a class named after an MFC class, or a function named after one that MFC or ATL puts in there also, somewhere in the inheritance chain.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
There is also the problem that if you name your H file after one of the system includes, it won't check for time changes. That one is a ***** to figure out.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Tim Smith wrote:
There is also the problem that if you name your H file after one of the system includes, it won't check for time changes.
Nope, I did a full search and there isn't anything that looks like my filename in the entire VS install. Nor is there anything in a full MSDN search with the same name.
I'm totally stumped.
J
|
|
|
|
|
Christian Graus wrote:
Have you tried renaming the class ?
Just tried it. Didn't help. But thanks.
I've looked through the preprocessor output and it's sitting right there.
It's as if it knows that CObjectCache is defined, and that CContainedObject is defined, but somehow CObjectCache<CContainedObject> isn't.
Does that make any sense?
J
|
|
|
|
|
I need a routine to save an icon to disc as an .ico file, or failing that copy an icon to the clipboard. Anybody know of one?
I'm never gonna work another day in my life. The gods told me to relax, They said I'm gonna get fixed up right. Monster Magnet, Powertrip
|
|
|
|
|
lookup the ICONINFO structure and search MSDN for the article "Icons in Win32"
- Roman -
|
|
|
|
|
Thanks!
I'm never gonna work another day in my life. The gods told me to relax, They said I'm gonna get fixed up right. Monster Magnet, Powertrip
|
|
|
|
|
Hey ! Anyone know how can i display a popup menu at top of mouse cursor(from bottom to top), anytime, even if the mouse isn't at the bottom of screen, and windows doesn't have to display the menu from bottom to top.
|
|
|
|
|
Do you mean you want the menu to be outside the screen?
I'm not sure of it if that is your question....
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
no... i didn't meant that...
i meant that if the mouse cursor is too close of the top of the screen to display the menu at bottom of the cursor, and normaly, by default, from down to top...
try to install trillian, and click the trilli button, and see where the menu is going from to where...
cheers
|
|
|
|
|
How can I get the string from a CString to a char*/char????
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
strcpy() or strncpy()
I'm never gonna work another day in my life. The gods told me to relax, They said I'm gonna get fixed up right. Monster Magnet, Powertrip
|
|
|
|
|
Holy god damnit!
I was soooooo sure it wouldn't work!
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
Must remember: the reason CString is so popular is MS made it easy for lazy programmers to use, and if you can't be a lazy programmer, then what's the point?
I'm never gonna work another day in my life. The gods told me to relax, They said I'm gonna get fixed up right. Monster Magnet, Powertrip
|
|
|
|
|
I have an active control which i need to insert during runtime . Assuming that the Active x class name is CActivex , how do i dynamically create windows and place them in an order for a MFC Dialog application ?
thanks
|
|
|
|
|
I think this should be works:
Insert the class and header of your activex to your project.Then you can define controler of it and use Create() function to create it at runtime.Is that clear?
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
I want to use the debugger to check if my arrays are filled correctly.
I have two arrays,
double xcoord1[80];
CPoint coord[80];
When I debug, I place my breakpoint right after I fill these arrays (still in the same function). Then I bring up the "Watch" debug window. But when I type xcoord1 under the name, i get the message: error in OMF type information.
And when I type coord, I get this under value: 0x0066f288
Why is all this happening?? And I know my array's have filled up properly, because if I put them to an oufile, I see that all the numbers I want are there. But why can't I view them with the debugger???
|
|
|
|
|
There's an article relating to some old versions of VC in MSDN that might help - I've never seen this problem myself:
"FIX: CXX0033 Error in OMF Type from Forward Class Declaration"
Seems to be a problem with the program database file when fwd decls used. What version of VC are you using?
|
|
|
|
|