News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Arduino and EtherCard.h

Started by botezelli, October 08, 2014, 04:04:03 PM

Previous topic - Next topic

botezelli

Hello everyone,

I'm trying to use <EtherCard.h> in Code::Blocks (Version 13.12 - Windows) but the compiler returns the error message below:

Test.ino: (.Text.setup + 0x2E) undefined reference to `EtherCard::begin(unsigned int, unsigned char const *, unsigned char)'

I've tried everything, but I can not compile successfully.

The same code works fine with the original Arduino IDE and also with Visual Micro (Arduino for Visual Studio).

But I want to use CodeBlocks which I love!

Does anyone know how to fix or give me an example of setting the correct environment CodeBlocks?


My simple code brief:

#include <Arduino.h>
#include <EtherCard.h>

#define BUF_SIZE 512

byte     mymac[]    = { 0x00, 0x04, 0xA3, 0x21, 0xCA, 0x38 };  // MAC address.
uint8_t myip[]       = { 192, 168, 0, 171 };                               // The IP address.
uint8_t dns[]         = { 8, 8, 8, 8 };                                          // The DNS server address.
uint8_t gateway[]  = { 192, 168, 0, 1 };                                   // The gateway router address.
uint8_t subnet[]    = { 255, 255, 255, 0 };                               // The subnet mask.

byte Ethernet::buffer[BUF_SIZE];

void setup()
{
...
   if (ether.begin(sizeof Ethernet::buffer, mymac,10) == 0)  // Pin 10 = CS
...
}
...


Thank you so much,
Botezelli

scarphin

Did you setup the correct compiler for Arduino in project options? Do you have that compiler installed? Does it compile the code when run from command line? What are you specs (OS, CB version)?

Please remember this is not a general programming board, only CB related questions (setup problems, bug reports etc...) are allowed here as it is stated in the forum rules.

LETARTARE

Hello,
I use 'Code::Block 13.12' under 'VISTA' to compile 'Grbl' on Arduino.
Here is an address that will give you an example.
https://github.com/LETARTARE/Mega2560-grbl-0.8xx/tree/devGrbl
Best regards
CB-13834, plugins-sdk-2.25.0 : Collector-2.6.5, AddOnForQt-5.1.2
1- Win7 Business Pack1 64bits : wx-3.2.8, gcc-15.2.0,
2- OpenSuse::Leap-15.6-64bits : wx-3.2.8;gtk3-u, gcc-15.2.0,
=> !! The messages are translated by 'Deepl'

stahta01

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]