catkin_make error: function TCPStreamSetup() was not declared in this scope

asked 2020-03-04 04:09:10 -0500

Parth gravatar image

I am building my catkin workspace which contains different .c and .cpp files. I already included all files in my CMakeLists.txt file in add executable section which looks like:

add_executable(${PROJECT_NAME}_node
SPI.c
led.c
TCPSendReceive.c
MC_Communication.cpp
MC_Communication_data.cpp
${${PROJECT_NAME}_C_SOURCES}
${${PROJECT_NAME}_CPP_SOURCES}
)

The implementation of function TCPStreamSetup() is in TCPSendReceive.c file as below:

void TCPStreamSetup(uint16_t portNumber, uint16_t localClientPort, uint16_t *connStream, uint16_t server, double blockingTimeout, int16_t *errorNo, char *hostName) {
.....
...
}

My main file MC_Communication.cpp call this function inside another function as below:

static void MC_Com(TCPReceive *obj)
{....
....
TCPStreamSetup(1234, 0, &connStream, tmp_0, 0.0, &errorNo, ipaddr);
....
}

Now when I build my workspace it is giving error that MC_Communication.cpp:142:3 error: TCPStreamSetup() was not declared in this scope

As I defined all linked executable inside my CMakeLists it should find this function implementation in TCPSendRecieve.c file.

Note: MC_Communication.cpp files also uses another functions implementation from TCPSend Recieve.c file and it is able to find all other functions excepting this.

Can anybody please give me solution? Thank you in advance.

Blockquote

Blockquote

edit retag flag offensive close merge delete