Other Parts Discussed in Thread: SYSBIOS
Tool/software: Code Composer Studio
Hello,
See the subject line.
I started with an example project (NIMU Basic Example) to build on. The whole project is in pure C. Now I am adding a couple C++ classes, which are really just encapsulated wrappers for C code.
Everything is compiling fine, as I have correctly compensated for the name mangling with occurs between C and C++. Here is a small sample of the code which is executed on an incoming TCP/IP connection:
newskt = accept(skt,(struct sockaddr*)&client, &size); System_printf("\nConnection arrived: SD: %x\n", newskt); System_flush(); ipaddr = client.sin_addr.s_addr; m_connection = new CCxn(); m_connection->Initialize(newskt,ipaddr);
The above code is in a CPP file, not a C file, so the compiler knows what "new" is.
Specifically, the failure is on the m_connection = new CCxn(); (line 58)
'Invoking: GNU Linker' "C:/ti/gcc-arm-none-eabi-4_9-2015q3/bin/arm-none-eabi-gcc.exe" -mtune=cortex-a8 ..... " C:\Users\scott\workspace_v7\NIMU_BasicExample_bbbAM335x_armExampleproject\Debug/../HTTP/Server.cpp:58: undefined reference to `operator new(unsigned int)' C:\Users\scott\workspace_v7\NIMU_BasicExample_bbbAM335x_armExampleproject\Debug/../HTTP/Server.cpp:58: undefined reference to `operator delete(void*)' C:\Users\scott\workspace_v7\NIMU_BasicExample_bbbAM335x_armExampleproject\Debug/../HTTP/Server.cpp:58: undefined reference to `__cxa_end_cleanup'
The problem is that the linker (not the compiler) says it can't find "new", "delete", or "__cxa_end_cleanup".
I am using GNU v 4.9.3 compiler. When I tried to change it to the GNU 6.3.1 compiler, I got a boatload of redefinition errors for "struct timeval" so I abandoned that strategy because I didn't want to spend the next few days figuring out why there are header conflicts.
What is the process to link a C++ project, and resolve these basci C++ operators?
Thanks.
-CSW