Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Compiler error when function has struct parameter (Read 2163 times)
Agner
Newbies
*
Offline


Posts: 1
Joined: Oct 26th, 2014
Compiler error when function has struct parameter
Oct 26th, 2014 at 5:30pm
Print Post  
The program below cannot compile on Atmel Studio 6.2 with Visual Micro plugin. The autogenerated header file makes a function prototype for the function parse, but without first declaring the struct Record. The compiler says: "phonelist.ino:6: error: 'Record' was not declared in this scope"
The line number in the error message points to an irrelevant line.

To reproduce, compile this code:

struct Record {
    unsigned long int phone;
    char name[18];
};

bool parse(Record * r) {   
    return true;
}

void setup(){}

void loop(){}
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Compiler error when function has struct parameter
Reply #1 - Oct 27th, 2014 at 12:36pm
Print Post  
Hi,

Yes that is correct, this is how Arduino works and you will see the same error in the Arduino IDE

Part of the arduino build process is to automatically create the c++ prototypes for all .ino files. You can avoid this by using cpp files or if you like to make prototypes yourself you can switch off automatic prototypes in the visual micro project properties. The latter is not recommended except for advanced users.

Thanks
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint