Hi all - I need a little help - again - I'm getting "undefined reference to 'GetDataSize()' " compiler message for my code for the line of code below in red - not sure why. the #include statements and code was copied right from the UDPSendRecieve example file, I just modified the while(1) loop. Here's the troublesome code.
#include "predef.h"
#include <stdio.h>
#include <ctype.h>
#include <startnet.h>
#include <ucos.h>
#include <udp.h>
#include <autoupdate.h>
#include <dhcpclient.h>
#include <sim.h>
#include <pins.h>
#include <ucosmcfc.h>
#include <pinconstant.h>
volatile WORD ADResult[8]; // Register holding the numeric value of the converted data from the ADC
extern "C" {
void UserMain(void * pd);
}
void AsciiToIp(); // Function converts ASCII characters to associated IP address.
PBYTE GetDataBuffer(); // Function makes a pointer to the data buffer
WORD GetDataSize(); // Function gets the size of the buffer
void ReadAD(void);
void InitSingleEndAD(); // Setup the A/D converter to be ready to run
void StartAD(); // Start A/D conversion set.
bool ADDone(); // Return true if the conversion is complete
WORD GetADResult(int ch); // Return the AD Result
void SetupGPIO(void); // GPIO setup routine
void PollGPIO(void); // Polls GPIO pins to get state
const BYTE PinNum[8] = { 15, 16, 18, 23, 17, 19, 20, 24 }; // J2 Pins for LEDs
const BYTE J1_PinNum[7] = { 5, 6, 7, 9, 10, 13, 31 }; // GPIO pins on J1
const BYTE J2_PinNum[17] = { 21, 22, 27, 30, 31, 32, 33, 34, 35, 36, 37, 40, 41, 42, 44, 47, 48 }; // GPIO pins on J2
const int PORT_IO[24] = {/* INSERT PORT ASSIGNMENT ELEMENTS HERE*/};
DWORD UdpTestStk[USER_TASK_STK_SIZE]; // Allocate task stack for UDP listen task
void UdpReaderMain(void * pd)
{
int port = (int)pd; // cast void * param as int port number
// Create a FIFO for the UDP packet and initialize it
OS_FIFO fifo;
OSFifoInit(&fifo);
// Register to listen for UDP packets on port number 'port'
RegisterUDPFifo(port, &fifo);
while (1)
{
// Construct a UDP packet object using the previously
// declared FIFO. The UDP constructor will only return
// when a packet has been received. The second parameter
// is a timeout value (timeticks). A value of 0 will
// wait forever. The TICKS_PER_SECOND definition can
// be used for code readability.
UDPPacket upkt(&fifo, 0 * TICKS_PER_SECOND);
// Did we get a valid packet, or just time out? If so, put it into data[k]
if (upkt.Validate())
{
PBYTE data_pointer = GetDataBuffer(); // points "data_pointer" to the (address) start of the data buffer
WORD buff_size = GetDataSize(); // Stores the size of the Data Buffer in "buff_size"
for (int i = 0; i < buff_size; i++)
{
unsigned int data_byte = *data_pointer; // Dereferences the data pointer to get data it's pointing towards
data = data_byte; // Data is stored in array location
i++; // increment
data_pointer++; // Next data location
}
}
}
}
MOD54415 Compiler error -
-
- Posts: 192
- Joined: Mon Dec 17, 2012 6:24 am
Re: MOD54415 Compiler error -
Anyone???
Re: MOD54415 Compiler error -
Do a make clean and try rebuilding your project and system files? If the line that it is reporting is actually
but the error is then you've got some major linker problems.
Also just to make sure, this is a '.cpp' file right...?
Code: Select all
OSFifoInit(&fifo);
Code: Select all
undefined reference to 'GetDataSize()
Also just to make sure, this is a '.cpp' file right...?
Dan Ciliske
Project Engineer
Netburner, Inc
Project Engineer
Netburner, Inc
-
- Posts: 192
- Joined: Mon Dec 17, 2012 6:24 am
Re: MOD54415 Compiler error -
Wes that's a .cpp file that I'm writing. It's strange, because I copied and pasted the function and all the #include files right from the example file. The only thing I changed was the output to the serial port - I need to work on the data that's incoming. I tried cleaning the file, it didn't help... I don't want to do it, but if I have to I'll start over from scratch and slowly add in my features until the error trips again... If anyone has an idea as to what could cause it, I'm willing to try anything... keep in mind, coding newb...
-
- Posts: 192
- Joined: Mon Dec 17, 2012 6:24 am
Re: MOD54415 Compiler error -
Ok, so I began all over again. I think I found the problem - I forgot to access the data buffer and data size with the precursor.. it should have been :
PBYTE data_pointer = upkt.GetDataBuffer();
and
WORD buff_size = upkt.GetDataSize();
I forgot the upkt part... sorry for all the trouble guys. Thanks again!!
PBYTE data_pointer = upkt.GetDataBuffer();
and
WORD buff_size = upkt.GetDataSize();
I forgot the upkt part... sorry for all the trouble guys. Thanks again!!
Re: MOD54415 Compiler error -
Ahh, my apologies. I should have seen that from the get go. Yea, when using objects you always need to tell the method what you're operating on 

Dan Ciliske
Project Engineer
Netburner, Inc
Project Engineer
Netburner, Inc