Solved

Precompile Templates

Posted on 2001-06-16
8
291 Views
Last Modified: 2010-04-02


Hi everybody...


I have a file 'A'.cpp that includes a 'B'.h file which in turn declares a template.

'B'.cpp which too includes 'B'.h compiled very well - I have 'B'.obj.

BUT when I try to compile 'A'.cpp I get a strage error message which comes from string_r.h !

Template declaration missing template parameters ('template<...>') in function __string_ref<char,char_traits<char>,allocator<char> >::__references() const

When I do not include 'B'.h in 'A'.cpp everything is all right.


I have no idea what in my project produces this error. I have many fils depending on each other and I could'n isolate the error to a smaller code snipsle.

Does anybody know what to do in this case ... ?


-Ingo

0
Comment
Question by:bormuth
8 Comments
 
LVL 7

Accepted Solution

by:
KangaRoo earned 25 total points
ID: 6198342
Where (which function or class member) is this template instantiated from, and how is instantiated?
If A.cpp compiles without B.h then why do you include it.

My first thoughts went to an incomplete declaration prior to the instantiation of the template, maybe even just a missing semicolon. But there is really not information enough to go on.

Start a new, smaller 'project', one file preferable and test B.h inside out - use every member of the template (!). Would be good if you could reproduce the error with this smaller 'project'.
0
 
LVL 30

Expert Comment

by:Axter
ID: 6198575
Look in B.cpp, and see if there are some #include there that you need to carry over to A.cpp
0
 

Expert Comment

by:jaisjoy
ID: 6201741


You can solve this problem by changing the order of #includes. Try by moving your low order #includes to top of the file
0
 
LVL 30

Expert Comment

by:Axter
ID: 6201780
Hi (jaisjoy), welcome to EE.
All of the experts here, for the most part have learn from other experts as to the proper etiquette for posting answer.

An answer should not be posted as an answer, if other experts have previously posted possible answers as comments, and/or have already made contributions to the question.

There are many experts who never post answers as answer.  Instead, they post their answers as comments.
If you read the following link, you'll see why this is the preferred method for many of our valued experts, including myself.

http://www.experts-exchange.com/jsp/cmtyQuestAnswer.jsp


Hi (bormuth):
Feel free to click the [Reject Answer] button near (Answer-poster's) response, even if it seems like a good answer.
Doing so will increase your chance of obtaining additional input from other experts.  Later, you can click the [Select Comment as Answer] button on any response.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 7

Expert Comment

by:KangaRoo
ID: 6201867
Are you suggesting a 'trial-and-error' approach for this, jaisloy?
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6811512
This question appears to have been abandoned. Your options are:
 
1.  Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you. You must tell the participants why you wish to do this, and allow for Expert response.
3.  Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4.  Delete the question. Again, you must tell the other participants why you wish to do this.
 
Please click this Help Desk link for Member Guidelines, Member Agreement and the Question/Answer process:  Click you Member Profile to view your question history and keep them all current with updates as the collaboration effort continues.
http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp
 
PLEASE DO NOT AWARD THE POINTS TO ME.  
_________________________________________
------------>  EXPERTS:
 
Please leave any comments regarding this question here on closing recommendations if this item remains inactive another three days.
 
Thank you everyone.
 
Moondancer
Community Support Moderator @ Experts Exchange
0
 
LVL 11

Expert Comment

by:griessh
ID: 6819196
I suggest to split between Kangaroo and Axter for their help.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner


0
 
LVL 6

Expert Comment

by:Mindphaser
ID: 6997022
Force accepted

** Mindphaser - Community Support Moderator **

Axter, there will be a separate question with points for your help.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
best sources to up-to-date in C++? 8 70
White board coding practice 3 80
C++ :Change value from  DisableCMD registry 4 50
FMX TCameraComponent Problem 2 52
Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now