Creating the Shared Library File from a C File

I’m trying to create a shared library file (.so extension) from my C file to call my C function from Python. I found several websites saying that we can use the following command to do so:

 cc -fPIC -shared -o my_functions.so my_functions.c

However, I am not sure where I need to run this command. I tried running this on the terminal of Visual Studio Code but got the following error:

> PS C:UsersmeDocumentsCProgramming903_> cc -fPIC -shared -o my_functions.so my_functions.c
cc : The term 'cc' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is
correct and try again.
At line:1 char:1 
+ cc -fPIC -shared -o my_functions.so my_functions.c
+ ~~
    + CategoryInfo          : ObjectNotFound: (cc:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Does anyone know what is the correct way or correct platform to run this command? For a note, I am using Windows. This is the website I referred to: https://www.journaldev.com/31907/calling-c-functions-from-python

Answer

cc is the compiler command. Your current shell (Powershell) can not find cc in your Path.

You either need to install a compiler (i.e. gcc) or add the compiler you have installed in your system to your Path.