Solved

Precompile Templates

Posted on 2001-06-16
8
294 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
maze travler 6 66
c++ reading data from file into two dimensional array 3 133
What is sub-make ? 2 88
keep track of class structure 1 22
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

730 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