Nobody can meaningfully help you resolve these problems when you don't post your complete code. Since you're not using Arduino, you must also post a clear description of how you've building the code (eg, a makefile, script, exact compiler commands, etc). We have the "Forum Rule" at the top of every page for exactly this reason, to help give you the best possible help with your problem. If your program is too large or contains secret or proprietary info, the expectation is you can trim it to only a small sample which demonstrate the issue without disclosing anything confidential.
Please, follow the Forum Rule. It saves everyone a lot of time, and it really does result in much better help for you.