Quantcast
Channel: LabWindows/CVI topics
Viewing all articles
Browse latest Browse all 5339

I want the ability to use/reformat a global string in multiple .c files. Error = Project Link Error: Multiple definitions for symbol...

$
0
0

Hi NI,

 

I usually find my solutions online but I'm struggling with this one. I've done this in an environment before but can't remember how I did it. 

 

So I'm working on an ethernet comm interface. I have a TCP file where I'm using the NI tcp functions (TCP_DATAREADY, TCP_CONNECT, etc), and I have a telnet.c file where I've created simple send and recieve ethernet commands. 

 

My issue right now is that I want to store the buffer I'm transmitting and the buffer I recieved for future use. Below is what I'm trying to accomplish.

 

*** memory.h file ****

extern char memTransmitString[256] = {0};

extern char memReadString[256] = {0};

 

*** telnet.c ***

#include "memory.h"

 

int SendTelnetCmd( bunch of stuff I need)

{

    // This sends the command   

    error = ReadTelnetData (readBuffer);

}

 

*** tcp.c ***'

#include "memory.h"

 

case (event)

{

    TCP_DATAREADY:

  

    // code gets what I want to read and I store this string in "readBuffer"

 

    Fmt (memReadString, "%s", readBuffer);  // this is where I want to store what I read into memory so I can access this string in multiple files.

    break;

}

 

 

*** telnet.c ***

ReadTelnetData (char *readBuffer)

{

     // I trigger a TCP_DATAREADY event here ^^^^^ this is where I'll make the ethernet read and WANT to store read string into a global that I can access in multiple iles

     Fmt (readBuffer, "%s", memReadString; // this wll store the string from memory into my return string for this function.

}

 

So basically the compiler is gettnig mad that I'm reformatting memReadString (even tho technically I'm not reformatting i'm just transferring it back and forth between readBuffer).

 

The error I get is Project Link Error: Multiple definitions for symbol memReadString.

 

Pretty much the same thing for memTransmitString.

 

Can you help me fix this? 

 

Thanks,

 

Justin

 

 

 

 


Viewing all articles
Browse latest Browse all 5339

Trending Articles