Hello Team,
I am seeing a linker error while building the code using C++ compiler "arm-none-eabi-g++"
Let me add little details, I have an existing project which has only C source files, but now I have created a new source file which is C++ based. Previously I used to build the code using "arm-none-eabi-gcc" C compiler, but after adding the new source file I have changed the compiler option to "arm-none-eabi-g++".
Surprisingly I am seeing many linker errors, adding one example error message here,
undefined reference to `sprintf(char*, char const*, ...)'
Even though sprintf was used in many source files, but this error shown in few source files.
I was able to build the code (before adding C++ source file) using "arm-none-eabi-gcc" option, but the error was seen only while building the code using "arm-none-eabi-g++" compiler command.
Can someone please let me know, what is going on here?
Regards,
San
Hello @Alice_Yang,
Few observations.
The existing project is created as a C project, but now I have added a .cpp source file to that project.
The existing project uses gcc compiler for building the code, where as after adding new .cpp file, I changed the compiler to g++ for building the code. That's when I saw the issue.
Please let me know, based on the above inputs, can you able to provide any pointers?
I am sorry, I can't share the project as it contains the confidential source code.
Regards,
San
Hello @sushmasan
Check the error message, it seems the lib you used doesn't support sprintf(char*, char const*, ...)'. It is recommend to replace the library. Some libraries only support C. About libraries description, please refer to "19.7 Libraries and linker scripts" of <MCUXpresso_ide_User guide>. I attach it for you.
Or do not use like print.
BR
Alice
Hello @sushmasan
For better help you , please share your project. I help you check it on my side. thanks.
BR
Alice