I am making a static cpp libray with extension .h and I have written source code for the same in a different file with .cpp extension. Now I want to make a test script that will include the custom library that I just created. When I include this libary using
#include<mylibrary.h>and try to run this test file, I get an error saying No such file or directory compilation terminated.
I know that I am getting this error because nowhere I have specified the path for same for the complier to look for this file as I used to do in Visual Studio environment. How to do the same in Visual Studio Code?
The location of your .h file needs to be either in your compiler libraries folders or in the folder where you execute g++/clang++ or whatever compiler you use.
These are the default search-paths but you can add additional ones by adding
the flag -I path/to/folder in your tasks.json (or makefile if you are using one).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With