I have recently tried using code::blocks to brush up my skills on C, I am running it on window 8.
The compiler of choice during the project choice I have selected was the GNU GCC compiler
And this is the code I attempted to compile and run:
#include <stdio.h>
#include <stdlib.h>
int main()
{
float f1;
float f2 = 443.34;
printf("f2:%f \n",f2);
scanf("%f",&f1);
f3 = f1 +f2;
printf("f3: %f", f3);
return 0;
}
my build log:
-------------- Build: Debug in LearnC3 (compiler: GNU GCC Compiler)---------------
mingw32-gcc.exe -Wall -g -c C:\Users\soh\Desktop\CPlay\LearnC3\main.c -o obj\Debug\main.o
mingw32-g++.exe -o bin\Debug\LearnC3.exe obj\Debug\main.o
Output file is bin\Debug\LearnC3.exe with size 28.54 KB
Process terminated with status 0 (0 minute(s), 1 second(s))
0 error(s), 0 warning(s) (0 minute(s), 1 second(s))
and my output will be:
f2: 443.339996
which is not right the decimal value will not be of the same as long as I declared it to be of XX.YYY, unless I declared a whole number I will not receive the output of XX.000000 which puzzle me what is wrong with my setup.
another problem I faced is when I closed code::blocks and run it again, I cant compile my previous project. I tried to run code::blocks on admin mode but it doesn't solve the problem.
I will be issued with the following warning:
||=== Build: Debug in learnC2 (compiler: GNU GCC Compiler) ===|
ld.exe||cannot open output file bin\Debug\learnC2.exe Permission denied|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|