You have to tell the compiler where to find cublas.h using a -I directive (something like -I/somepath/cuda/include). The extern “C” declaration is required to prevent any C++ function name mangling from happening and tell the compiler to use strict C semantics for the function call.
You need to specify both the location ( with -L/usr/local/cuda/lib64 ) and the library name ( -lcublas).
You also need to put these at the end of the command ( the linker resolve left to right).
Assuming that cuda is installed in /usr/local/cuda:
g++ -I/usr/local/cuda/include -o main main.c -L/usr/local/cuda/lib64 -lcublas
You should get familiar with Linux and the gcc toolchain.
It is libcublas.so. But take the advice offered and spend some time familiarizing yourself with how the build system works. There is a world of pain coming if you don’t and plan on building complex applications.