Search This Blog

Showing posts with label compiler. Show all posts
Showing posts with label compiler. Show all posts

How to Use Mathematical Functions in Math.h in GCC Compiler for C

Linux operating systems use GCC (GNU Compiler Collection). In recent versions versions of GCC, it is not enough to include the line #include<math.h> to use functions in math.h header file. The most commonly used functions in math.h are sqrt, pow, abs, sin, cos, tan, exp, log, log10, ceil, floor etc. If you use any of the functions defined  in math.h header file, even if you include the #include<math.h> pre-processor directive, the compiler may show an error. In such case you should manually link to math.h file. Suppose you are going to compile a file myfile.c which uses functions under math.h header, you may use the following commands in terminal for gcc:

gcc myfile.c -lm

or

gcc myfile.c -o outputfilename -lm

-l option is used to manually link libraries. -lm directs the compiler to manually link libm. So, if we use the math library, we have to manually link it in gcc compilers. It is said to be for the reason that earlier processors were slow and floating point capabilities were limited. It is also said that it is for the reason embedded computing components are not having much computing capabilities especially for floating point operations or some of them even do not need it. So, math.h is avoided from automatic linking.

C and C++ Compiler For Android Smartphones

In this post i'm listing some C Program compilers for Android phones or tabs. It will be very handy if you have one in your phone if you are a programming student. You don't need to have a laptop or a Personal computer with you.

C4Droid


It is a powerful offline C/C++ IDE + C/C++ compiler for Android operating System. I have been using it for 1 year. You do not need to root your phone to use this app. Its features are as listed below:



  • Syntax highlighting
  • Multiple tabs
  • code complete
  • Auto formating
  • Options to export the program as apk or other Executables
  • Full ANSI C and ISO C99 support with TCC (Tiny C Compiler) + uClibc
  • Customizable Graphical User Interface with themes
  • C++ support with GCC+
  • Debugger with breakpoints and watches





C4droid - C/C++ compiler & IDE compiler app application android apk full version free playstore download
C4Droid screen shot


Playstore link to the Application

CppDroid - C/C++ IDE

This is another offline compiler but it is freeware app. Rooting is not required. You don't have to pay for it. It is designed for educational purposes as the developer says, "CppDroid is simple C/C++ IDE focused on learning programming languages and libraries".

CppDroid - C/C++ IDE - compiler application for Android mobile phones
Features:
  • real-time diagnostics (warnings and errors) and fixes
  • syntax highlighting
  • portrait or landscape UI
  • C/C++ code examples and guides
  • GUI customisation with themes


C Compiler

A very simple and basic C compiler for Android phones. Not many features.

Find it in Google playstore