When you comment out the sscanf call, all of the variables have values known at compile time, and the compiler's optimiser is able to determine the result of the powl call without actually calling any functions declared in math.h.
When you comment out the sscanf call, all of the variables have values known at compile time, and the compiler's optimiser is able to determine the result of the powl call without actually calling any functions declared in math.h. When you uncomment the scanf call, the optimiser is unable to determine at compile-time the result of the powl call, so it must call the real powl function, which is in a separate library that you must link in with your program with -lm.
Good explanation of why commenting out sscanf works when optimisations are enabled in the compiler. – AusCBloke Jan 5 at 4:05.
Linking with the math library (-lm) removes the undefined reference to 'powl' error: gcc -o test test. C -lm This is also stated in the man pages for powl: SYNOPSIS #include double pow(double x, double y); float powf(float x, float y); long double powl(long double x, long double y); Link with -lm. EDIT: It only compiles for me when sscanf is commented out if it's also compiled with optimisations (-OX), dreamlax has the reason in his answer.
Agree with AusCBloke - from the man page "Link with -lm. " – Adrian Cornish Jan 5 at 3:53 This doesn't explain the other phenomenon where it compiles and works correctly without the sscanf call. – dreamlax Jan 5 at 3:57 @dreamlax excellent point - I did not read question in detail - nice find.
– Adrian Cornish Jan 5 at 4:02 1 Recommendation: libraries should follow object files on the (linker) command line. – Jonathan Leffler Jan 5 at 4:09 1 With static libraries, the libraries are scanned on the command line in sequence, and only object files that satisfy an unsatisfied reference are taken from the library. Therefore, with static linking, it is crucial that libraries follow the object files that reference the libraries.
Shared libraries are different, and some linkers will scan libraries as they are listed and ensure they are loaded at runtime, but this can lead to the dynamic loader loading libraries that aren't really needed. Sometimes, the linker won't pull in symbols from shared libraries listed before the object files. – Jonathan Leffler Jan 5 at 4:16.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.