title: I am fairly new to code blocks.I have spent too much time on this error .Can someone point out what is my mistake in this code
body: <p>I am new to codeblocks. I was trying to find height of a BST and used <code>max()</code> function. But while compiling CodeBlock throws error.I am using Windows machine.I know linking maths.h manually will solve the issue.I know how to link math.h manually using gcc but i dont know gcc equivalent for windows.Basically i want to know is there any other solution besides linking??If manually linking is the only option left then how to do it on Windows on CodeBlocks.Thank you!!</p>
  
  <blockquote>
    <p>undefined reference to max</p>
  </blockquote>
  
  <p>I am pretty sure there is no error in logic all import statements are correct too. But still no output!! Here is the code:</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;stdlib.h&gt;
  #include&lt;math.h&gt;
  
  //Definition of Node for Binary search tree
  struct BstNode {
      int data;
      struct BstNode* left;
      struct BstNode* right;
  };
  struct BstNode* GetNewNode(int);
  struct BstNode* Insert(struct BstNode*,int );
  int findHeight(struct BstNode *);
  //struct BstNode* findMin(struct BstNode* root)
  // Function to create a new Node in heap
  struct BstNode* GetNewNode(int data) {
      struct BstNode* newNode = (struct BstNode*)malloc(sizeof(struct BstNode));
      newNode-&gt;data = data;
      newNode-&gt;left = newNode-&gt;right = NULL;
      return newNode;
  }
  
  // To insert data in BST, returns address of root node
  struct BstNode* Insert(struct BstNode* root,int data) {//pass by value therefore * used and reurn stmt.otherwise pbarg ** no return
      if(root == NULL) { // empty tree
          root = GetNewNode(data);
      }
      // if data to be inserted is lesser, insert in left subtree.
      else if(data &lt;= root-&gt;data) {
          root-&gt;left = Insert(root-&gt;left,data);
      }
      // else, insert in right subtree.
      else {
          root-&gt;right = Insert(root-&gt;right,data);
      }
      return root;
  }
  int findHeight(struct BstNode * root){
      if(root=NULL){
          return -1;
      }
      else{
          return max(findHeight(root-&gt;left),findHeight(root-&gt;right))+1;
      }
  
  };
  //BstNode* findMin(BstNode* root)
  int main() {
      int a,b;
      struct BstNode* root = NULL;  // Creating an empty tree
      /*Code to test the logic*/
      root = Insert(root,15);
      root = Insert(root,10);
      root = Insert(root,20);
      root = Insert(root,25);
      root = Insert(root,8);
      root = Insert(root,12);
  findHeight(root);
  }
  </code></pre>