Solved

Precompile Templates

Posted on 2001-06-16
8
290 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

708 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

14 Experts available now in Live!

Get 1:1 Help Now