I'm writing a library and fought my way through learning how and a bunch of bugs to get 1 more compile error. I could only find 1 other example in the forums and the solution was to put main() in the code. Since I'm writing a library I figured I wouldn't want to do this. There error is:
" Undefined symbol main (referred from rtentry2.o). (EL6218E)" in file "/"
Here is the code:
#ifndef MBED_DCSS500_H
#define MBED_DCSS500_H
#include "mbed.h"
#include "EthernetNetIf.h"
#include "HTTPClient.h"
namespace mbed {
class TWITTER {
public:
TWITTER(const char username[], const char password[]);
int tweet(char);
char latestMention(void);
protected:
char msg, r;
EthernetNetIf _eth;
HTTPClient _twitter;
};
}
#endif
#include "twitter.h"
#include "mbed.h"
#include "EthernetNetIf.h"
#include "HTTPClient.h"
using namespace mbed;
TWITTER::TWITTER(const char username[], const char password[])
: _eth(), _twitter() {_eth.setup(); _twitter.basicAuth(username, password);}
int TWITTER::tweet(char msg) {
HTTPMap status;
status["status"] = msg;
HTTPResult r = _twitter.post("http://api.supertweet.net/1/statuses/update.xml", status, NULL);
if ( r == HTTP_OK ) {
return 1;
} else {
return 0;
}
}
char TWITTER::latestMention() {
//TODO Later
return 0;
}
I'm writing a library and fought my way through learning how and a bunch of bugs to get 1 more compile error. I could only find 1 other example in the forums and the solution was to put main() in the code. Since I'm writing a library I figured I wouldn't want to do this. There error is:
Here is the code:#ifndef MBED_DCSS500_H #define MBED_DCSS500_H #include "mbed.h" #include "EthernetNetIf.h" #include "HTTPClient.h" namespace mbed { class TWITTER { public: TWITTER(const char username[], const char password[]); int tweet(char); char latestMention(void); protected: char msg, r; EthernetNetIf _eth; HTTPClient _twitter; }; } #endif#include "twitter.h" #include "mbed.h" #include "EthernetNetIf.h" #include "HTTPClient.h" using namespace mbed; TWITTER::TWITTER(const char username[], const char password[]) : _eth(), _twitter() {_eth.setup(); _twitter.basicAuth(username, password);} int TWITTER::tweet(char msg) { HTTPMap status; status["status"] = msg; HTTPResult r = _twitter.post("http://api.supertweet.net/1/statuses/update.xml", status, NULL); if ( r == HTTP_OK ) { return 1; } else { return 0; } } char TWITTER::latestMention() { //TODO Later return 0; }