Pages: [1]   Go Down
Author Topic: error in library file  (Read 451 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

An error occurred when i tried to upload the file into arduino atmega2560. Below is one of the library files where the error is highlighted at.
The error says:
Code:
herkulex.h:7: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'herkulex'
herkulex.c:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token
herkulex.c:166: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token
herkulex.c:172: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token
herkulex.c:194: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token
herkulex.c:285: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token

And the 'class' word in this file is highlighted.
 
May I know what's wrong with this code? Thanks!

code:

Code:
#ifndef herkulex_lib
#define herkulex_lib

#include <Arduino.h>
#include <Wire.h>
#include<inttypes.h>

class herkulex
{
  public:
    herkulex();
    void hklx_Init(unsigned long ulBaudRate);
    void hklx_SendPacket(DrsPacket stPacket);
    unsigned char hklx_ucReceivePacket(DrsPacket *pstPacket);
    void hklx_RemoveInvalidData(void);

//no private  
};

#endif /* HERKULEX_H_ */


Moderator edit: [code] [/code] tags added.
« Last Edit: November 13, 2012, 03:48:31 am by Coding Badly » Logged

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 210
Posts: 13036
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


DrsPacket is defined in your code.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry do you mean that DrsPacket should be defined in this library?
It is a typedef struct that i defined in herkulex.c file.
Logged

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 210
Posts: 13036
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


I'm saying what you have posted is inadequate for the purpose of determining why you are having trouble compiling.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 640
Posts: 50335
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Sorry do you mean that DrsPacket should be defined in this library?
It is a typedef struct that i defined in herkulex.c file.
Why is it defined in the source file when it is referenced in the header file? If it is defined in the header file, it can be referenced in the source, but the opposite is not true.
Logged

Pages: [1]   Go Up
Jump to: