Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VC++: fprintf error in release mode

I'm working in visual studio 2010 and I have code written in C.

If i run in 'Debug' mode, the code will run without any error or warning.

But if I run the same in 'Release' mode, errors and warning will appear.

Error List:

        warning C4013:'fprintf' undefined; assuming extern returning int
        error C2065: 'stdout': undeclared identifier

What is the reason? please help

like image 370
SHRI Avatar asked Feb 12 '26 09:02

SHRI


2 Answers

warning C4013:'fprintf' undefined; assuming extern returning int

It looks like you didn't include stdio.h.

like image 70
cnicutar Avatar answered Feb 15 '26 15:02

cnicutar


Seems like a difference in configuration between Release and Debug. Check the values for "Whole Program Optimization", they may differ between the two build configurations.


I had the same problem in reverse: In Release mode everything was fine, but in Debug mode some functions like 'ext' (FFTW library) were reported as "undefined; assuming extern returning int".

The failing build configuration (Release in my case) had under project properties Configuration Properties > General the option "Whole Program Optimization" set to No Whole Program Optimization.

The successful build configuration had this set to Use Link Time Code Generation. When I set that option in my failing target as well, everything worked fine.

like image 40
Diana Avatar answered Feb 15 '26 13:02

Diana



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!