Thread: Why extern doesn't compile?

  1. #1
    Registered User
    Join Date
    Mar 2021
    Posts
    4

    Why extern doesn't compile?

    Code:
    =================================NewUnit_0.h
    extern unsigned int *Xc, *Yc;
    extern unsigned int t, u, a, b;
    
    
    
    
    =================================Main.c
    #include "NewUnit_0.h"
    
    
    void main() {
    
    
      Start_TP();
      Xc = 1;
      Yc = 1;
    
    
      while (1) {
        Check_TP();
        GetCoordinates();
      }
    }
    
    
    
    
    ===============================abc_events_code.c
    #include "NewUnit_0.h"
    
    
    Xc = 0; //&a;
    Yc = 0; //&b;
    
    
    
    
    void GetCoordinates(){
    
    
     if (TP_TFT_Press_Detect()) {
    
    
    
    
        if (TP_TFT_Get_Coordinates(&Xc, &Yc ) > 120) {
        t = *Xc;
        u = *Yc;
        ProgressBar1.Position =  180;
        }
      }
    }
    Please view errors screen shot

    Thanks for any help greatly appreciated!
    Attached Images Attached Images Why extern doesn't compile?-extern-errors-jpg 

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,328
    So which compiler are you using?

    > void main()
    main returns an int.

    > Xc = 1;
    > Yc = 1;
    Surprised the compiler will do this, given they're pointers.

    > Xc = 0; //&a;
    > Yc = 0; //&b;
    You forgot the types.

    As in
    unsigned int *Xc = 0, *Yc = 0;
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. cannot compile with extern struct
    By jeanluca in forum C Programming
    Replies: 4
    Last Post: 06-08-2009, 02:51 AM
  2. Replies: 17
    Last Post: 12-15-2006, 11:02 AM
  3. Doesn't Compile
    By Justin C in forum C++ Programming
    Replies: 12
    Last Post: 04-29-2005, 06:40 PM
  4. Replies: 3
    Last Post: 03-07-2003, 09:06 PM

Tags for this Thread