Need guidance with template class and understanding line errors
<p>and I am trying to now do a Breadth First Order for files but, when I implement this template class to use a Queue I get this errors?, any idea where this might be?, also I do not understand the way the line number where the error is, is specified (i.e myprogram.c:23:10) no idea where that is</p>

<pre><code>program.c:11:10: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘&lt;’ token
program.c:22:10: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘&lt;’ token
program.c:33:10: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘&lt;’ token
program.c: In function ‘display_info’:
program.c:49:3: error: ‘q_type’ undeclared (first use in this function)
program.c:49:3: note: each undeclared identifier is reported only once for each function it appears in
program.c:49:10: error: ‘string’ undeclared (first use in this function)
program.c:49:18: error: ‘bfFilesQueue’ undeclared (first use in this function)
program.c:50:18: error: ‘bfDirsQueue’ undeclared (first use in this function)
</code></pre>

<p>Now the Queue class was taken from here, and I want to use it with strings , basically a file path</p>

<p><a href="http://www.java2s.com/Code/Cpp/Generic/Createagenericqueue.htm" rel="nofollow">http://www.java2s.com/Code/Cpp/Generic/Createagenericqueue.htm</a> </p>

<p>So my questions are, because i don't expect you to debug this for me.. but want to know the following:</p>

<ul>
<li><p>I tried to declare the queue at the top after the #include's so that i have have access to them globally. It seems like it does not like it because i am trying to use it from the display_info function. How can I declare this so that I have access to those Queues from anywhere?</p></li>
<li><p>I dont understand how to check in which line it is telling about the error (i.e. :12:10), i took that Template class from the link i posted.. not sure why would it throw an error.. How can I know the line number based on those weird numbers?</p></li>
</ul>

<p>So the code and errors are just informational so that you may answer those two questions with enough information.. any help will be much appreciated.</p>

<p>Thank you</p>

<pre><code>#define _XOPEN_SOURCE 500
#include &lt;ftw.h&gt;
#include &lt;stdio.h&gt;
#define SIZE 100

template &lt;class Qtype&gt; class q_type {
    Qtype queue[SIZE]; 
    int head, tail;    
public:
    q_type() { 
        head = tail = 0; 
    }
    void q(Qtype num); 
    Qtype deq();  
};  

template &lt;class Qtype&gt; void q_type&lt;Qtype&gt;::q(Qtype num)
{
    if(tail+1==head || (tail+1==SIZE &amp;&amp; !head)) {
        cout &lt;&lt; "Queue is full.\n";
        return;
    }
    tail++;
    if(tail==SIZE) 
        tail = 0; // cycle around
    queue[tail] = num;
}

template &lt;class Qtype&gt; Qtype q_type&lt;Qtype&gt;::deq()
{
    if(head == tail) {
        cout &lt;&lt; "Queue is empty.\n";
        return 0;  
    }
    head++;
    if(head==SIZE) 
        head = 0; 
    return queue[head];
}

q_type&lt;string&gt; bfFilesQueue;
q_type&lt;string&gt; bfDirsQueue;


static int display_info(const char *fpath, const struct stat *sb,
        int tflag, struct FTW *ftwbuf)
{

    //Check the type of Flag (i.e File or Directory)
    switch(tflag)
    {
        case FTW_D: 
        case FTW_F: 
            bfFilesQueue.q(fpath);
            break;

        case FTW_DP: 
            bfDirsQueue.q(fpath);
            break;
    }
    return 0; /* Continue */
}
</code></pre>
