Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

struct

Altera_Forum
Honored Contributor II
1,010 Views

struct test 

int number; 

char name[20]; 

}; 

test t; 

 

 

in the nios ide the compiler says: test undeclared, why?
0 Kudos
5 Replies
Altera_Forum
Honored Contributor II
319 Views

 

--- Quote Start ---  

originally posted by asegers@Jul 19 2006, 01:18 PM 

struct test 

  { 

    int number; 

    char name[20]; 

  }; 

  test  t; 

 

 

in the nios ide the compiler says: test undeclared, why? 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=17003) 

--- quote end ---  

 

--- Quote End ---  

 

http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif  

try 

typedef struct test 

int number; 

char name[20]; 

}; 

 

test t;
0 Kudos
Altera_Forum
Honored Contributor II
319 Views

 

--- Quote Start ---  

originally posted by slava+jul 19 2006, 11:46 am--><div class='quotetop'>quote (slava @ jul 19 2006, 11:46 am)</div> 

--- quote start ---  

<!--quotebegin-asegers@Jul 19 2006, 01:18 PM 

struct test 

  { 

    int number; 

    char name[20]; 

  }; 

  test  t; 

 

 

in the nios ide the compiler says: test undeclared, why? 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=17003) 

--- quote end ---  

 

--- Quote End ---  

 

http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif  

try 

typedef struct test 

int number; 

char name[20]; 

}; 

 

thanks, but still the same err. 

 

test t; 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=17006)</div> 

[/b] 

--- Quote End ---  

0 Kudos
Altera_Forum
Honored Contributor II
319 Views

Hi asegers, 

 

I think you are right in declaration point of.. 

 

Just try out this one too:::: 

 

typedef struct test 

int number; 

char name[20]; 

}t; 

 

And plz check one thing..the header file( In which you define this structure declaration) is must be include in your source file(*.c). so your source file get the declaration of this structure and your compiler will compile the code without error.. 

 

Best Regards, 

slsnios
0 Kudos
Altera_Forum
Honored Contributor II
319 Views

TO_BE_DONE

0 Kudos
Altera_Forum
Honored Contributor II
319 Views

or type 

 

&#39;struct test t&#39; 

 

 

--- Quote Start ---  

originally posted by asegers@Jul 19 2006, 06:18 AM 

struct test 

  { 

    int number; 

    char name[20]; 

  }; 

  test  t; 

 

 

in the nios ide the compiler says: test undeclared, why? 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=17003) 

--- quote end ---  

 

--- Quote End ---  

0 Kudos
Reply