Collect2.exe: error: ld returned 116 exit status

I’m trying to test my code on native.

I worked when using g++ 8 but I upgraded to g++14 to be able to use C++17.

I get this error when running the test:

collect2.exe: error: ld returned 116 exit status
*** [.pio\build\native\program.exe] Error 1

Why does this happen?

Can you upload a minimal project with which this happens?

same error is happening to me can you please help me with this!


it only happens when i run a c++ program but do not with c program.

Here is the c program too