title: C++ error expected primary-expression before '(' token
body: <p>I am trying to create a program that takes N random nodes from user input and creates a random integer that is put into a binary tree and then copied into a priority queue. The integer becomes the key for each node and another integer counts the frequency of the key. I run into issues when I copy into the priority queue because I get duplicates and I need to remove them.  I tried to create a set through the node constructor but I get the error above in the .cpp file.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;random&gt;
  #include &lt;ctime&gt;
  #include &lt;queue&gt;
  #include &lt;set&gt;
  #include &lt;functional&gt;
  #include &lt;algorithm&gt;
  #include&lt;list&gt;
  #include "Q7.h"
  
  using namespace std;
  
  int main()
  {
  node * root=NULL;
  node z;
  int n,v;
  
  vector&lt;int&gt; first;
  vector&lt;int&gt;::iterator fi;
  
  default_random_engine gen(time(NULL));
  cout&lt;&lt;"how many values? "; cin&gt;&gt;n;
  
  for(int i=0; i&lt;n; i++)
  {  (v=gen()%n);
  first.push_back(v);
  
      if(root==NULL){root = node(set(v));}///This is where I get the error!!
      else{
        root-&gt;addnode(v);
         }
  }
  
  z.unsortedRemoveDuplicates(first);
  
  cout&lt;&lt;"Binary Tree in a depth first manner with Duplicates removed!"&lt;&lt;endl;
  for ( fi = first.begin() ; fi != first.end(); ++fi{cout&lt;&lt;"Node "&lt;&lt;*fi&lt;&lt;endl;}
  cout&lt;&lt;"-------------------"&lt;&lt;endl;
  root-&gt;display();
  cout&lt;&lt;"-------------------"&lt;&lt;endl;
  cout&lt;&lt;"-------------------"&lt;&lt;endl;
   root-&gt;display_Queue1();
  cout&lt;&lt;"-------------------"&lt;&lt;endl;
  
  return 0;
   }
  
  
  
  
  
  my .h file
  
  class node
  {
  public:
  node(){left=NULL; right=NULL; ct = 1;}
  node set(int v) {val = v; left=NULL; right=NULL; ct=1;}
  node (int Pri, int cat)
  : val(Pri), ct(cat) {}
  
  friend bool operator&lt;(//sorts queue by lowest Priority
  const  node&amp; x, const  node&amp; y)  {
      return x.val &lt; y.val;
  }
  
  friend bool operator&gt;(//sorts queue by greatest Priority
  const node&amp; x, const node&amp; y) {
      return x.ct &gt; y.ct;
  }
  
  friend ostream&amp;//prints out queue later
  operator&lt;&lt;(ostream&amp; os, const node&amp; Pri) {
  return os  &lt;&lt;"my value = "&lt;&lt;Pri.val&lt;&lt;" occured "&lt;&lt;Pri.ct&lt;&lt;" times";
  }
  
  int unsortedRemoveDuplicates(vector&lt;int&gt;&amp; numbers)
  {
  node set&lt;int&gt; seenNums; //log(n) existence check
  auto itr = begin(numbers);
  while(itr != end(numbers))
  {
      if(seenNums.find(*itr) != end(seenNums)) //seen? erase it
          itr = numbers.erase(itr); //itr now points to next element
      else
      {
          seenNums.insert(*itr);
          itr++;
      }
  }
  return seenNums.size();
  }
  priority_queue&lt;node, vector&lt;node&gt;, greater&lt;node&gt; &gt; pq;
  priority_queue&lt;node, vector&lt;node&gt;, less&lt;node&gt; &gt; pq1;
  
  void addnode(int v)
  {
     if(v==val){ct++;}
     pq.emplace(node (set (v)));///No error here for set with constructor why??
     pq.emplace(node (set (v)));
      if(v&lt;val)
          {
          if(left==NULL){left=new node(set(v));
              }
          else{left-&gt;addnode(v);
              }
          }
      else
          {
          if(right==NULL){right = new node (set(v));
              }
          else{right-&gt;addnode(v);
              }
          }
  }
  
  int display()
      {
          if(left!=NULL){left-&gt;display();}
  
          cout&lt;&lt;"frequency  "&lt;&lt;ct&lt;&lt;" value"&lt;&lt;val&lt;&lt;endl;
  
          if(right!=NULL){right-&gt;display();}
      }
  
  void display_Queue()
      {
          cout &lt;&lt; "0. size: " &lt;&lt; pq.size() &lt;&lt; '\n';
          cout &lt;&lt; "Popping out elements from Pqueue..."&lt;&lt;'\n';
          while (!pq.empty())
          {
          cout &lt;&lt; pq.top() &lt;&lt;  endl;
          pq.pop();
          }
          cout &lt;&lt; '\n';
      }
          void display_Queue1()
      {
          cout &lt;&lt; "0. size: " &lt;&lt; pq1.size() &lt;&lt; '\n';
          cout &lt;&lt; "Popping out elements from Pqueue..."&lt;&lt;'\n';
          while (!pq1.empty())
          {
          cout &lt;&lt; pq1.top() &lt;&lt;  endl;
          pq1.pop();
          }
          cout &lt;&lt; '\n';
      }
  
  private:
  int val;      ///value in that node
  int ct;
  ///ct = count of that value
  node * left;
  node * right;
  };
  </code></pre>