This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/TMS570LC4357: Problems compiling the lwIP demo with C++

Part Number: TMS570LC4357

Tool/software: Code Composer Studio

Hello,

I have a project where I altered the lwIP demo so that I cand receive data on CAN and send it over UDP using the lwIP api functions. This works great. Now I wanted to include some C++ files in the project. From what I understood from reading other forums, you have to rename the file witht the main function to .cpp from c., in order for the compiler to treat code as C++ rather than C.

After changing the extension of the HL_sys_main file and the lwip_main file to .cpp,I get some weird errors regarding the two functions for interrupt handler for core 0 Receive and Transmit interrupt. Below is a screenshot of the error and functions :

I cannot find what I should change for these two functions in order for them to work with C++. Any help would be greatly appreciated.

Thank you.

  • I am not familiar with the lwIP demo, but I can still shed some useful light.

    It is likely that TI testing of this demo does not include compiling it as C++.

    The problem you have with those pragmas is discussed in the article Pragmas in C++.

    Thanks and regards,

    -George

  • You were right, the problems were with the pragmas. Defining that file as a .cpp one would yield errors, and then I had to change the syntax, but that created more problems.

    The solution was to leave the file with the pragmas as a .c one, and declare the function that I was calling from that file as a

    extern "C" void EMAC_LwIP_Main(uint8_t * emacAddress);

    in the .cpp file with the main function.

    Thank you for your response,

    Adrian.