title: C not seeing my function correctly?
body: <p>Im new to C. I have a function defined as such:</p>
  
  <pre><code>/*
   * Draws an image in mode3 USING DMA.
   * int x x coordinate 
   * int y y coordinate
   * int width Width of the image (Note may not be the same width as the GBA)
   * int height Height of the image (Note may not be the same height as the GBA)
   * const u16* pointer to the first element in the image
   */
  void drawImage3(int x, int y, int width, int height, const u16* image)
  {
      int r;
      for (r=0; r&lt;height; r++) {  
  
              DMA[3].src = &amp;image;
              DMA[3].dst = &amp;videoBuffer[OFFSET(x+width, y, 240)];
              DMA[3].cnt = width | DMA_SOURCE_FIXED| DMA_ON | DMA_DESTINATION_INCREMENT; 
              image = &amp;image + (r * width);
  
      }
  
  }
  </code></pre>
  
  <p>In a .h file I include in my main program I have this:</p>
  
  <pre><code>void drawImage3(int x, int y, int width, int height, const u16* image);
  </code></pre>
  
  <p>where u16 means an unsigned short and is defined elsewhere.</p>
  
  <p>And these, too, are in my .h file:</p>
  
  <pre><code>extern unsigned short *videoBuffer;
  extern const unsigned short *pt; 
  </code></pre>
  
  <p>in another h file is an array of 1024 const unsigned shorts.</p>
  
  <p>In my main.c file I call my function like this:</p>
  
  <pre><code>pt = imgArray;
  drawImage3(25,25, img_WIDTH, img_HEIGHT, pt);
  </code></pre>
  
  <p>I get a lot of errors.</p>
  
  <pre><code>Program.c:22: error: data definition has no type or storage class
  Program.c:22: error: type defaults to 'int' in declaration of 'pt'
  Program.c:22: error: conflicting types for 'pt'
  myLib.h:21: note: previous declaration of 'pt' was here
  Program.c:22: error: initializer element is not constant
  Program.c:23: error: expected declaration specifiers or '...' before numeric constant
  Program.c:23: error: expected declaration specifiers or '...' before numeric constant
  Program.c:23: error: expected declaration specifiers or '...' before numeric constant
  Program.c:23: error: expected declaration specifiers or '...' before numeric constant
  Program.c:23: error: expected declaration specifiers or '...' before 'pt'
  Program.c:23: error: data definition has no type or storage class
  Program.c:23: error: type defaults to 'int' in declaration of 'drawImage3'
  Program.c:23: error: conflicting types for 'drawImage3'
  myLib.h:117: note: previous declaration of 'drawImage3' was here
  </code></pre>
  
  <p>Any ideas of whats going on here?</p>
  
  <p>-------EDITS</p>
  
  <p>Yes, Oli, you are right about the first error. Thanks! I've edited my function as such and that error is gone. I've also made my *pt and extern.</p>
  
  <p>Program.c:</p>
  
  <pre><code>//Philip Johnson
  #include &lt;stdio.h&gt;
  #include "img.h"
  #include &lt;unistd.h&gt;
  #include "myLib.h"
  #include "text.h"
  
  typedef struct        // This typedef defines a new type called MOVOBJ
  {                     // which are structures that hold all the info for
      int row;          // a single movable object
      int col;
      int rdel;
      int cdel;
      u16 color;
  
  } MOVOBJ;
  
  MOVOBJ newcharacter, car1, car2, car3;
  int size = 5;
  int speed = 2;
  int checkforend = 0;
  pt = imgArray;
  drawImage3(25,25, img_WIDTH, img_HEIGHT, pt);
  int main(){ //....and so on from there
  </code></pre>