code-errrors

Building a Command Line Tool which provides suggestions when developers face errors while coding!

How it works

Steps to set it up

Installation

Run the following commands for MacOS:

bash brew tap probro27/tap brew install code-errors

Usage - Example

Write a hello.c file with the code (bonus if you can find the obvious error)

```c

include

int main() { print("Hello world!"); return 0; } ```

This looks like a simple hello world program. Let's compile it using our favourite complier gcc.

Run: code-errors gcc hello.c

Result:

```bash Result: Code: 1, error/output: hello.c:4:5: error: implicit declaration of function 'print' is invalid in C99 [-Werror,-Wimplicit-function-declaration] print("Hello world!, %1f"); ^ hello.c:4:5: note: did you mean 'printf'? /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer /SDKs/MacOSX.sdk/usr/include/stdio.h:170:6: note: 'printf' declared here int printf(const char * _restrict, ...) _printflike(1, 2); ^ 1 error generated. Suggestion is:

Suggestion: The error message is telling that the implicit function 'print' is being used in line 4 - it should either be changed to 'printf' or the library containing the definition of 'print' should be included. It is also suggesting to include stdio.h header file which contains the definition of printf() function.

Links: 1. Implicit function declaration - https://en.cppreference.com/w/c/language/implicit_declaration 2. printf() - https://en.cppreference.com/w/c/io/printf ```