I want include a header from internet. For example: file add.h and add.cpp have been post to github.com
file add.h is int add(int a,int b);
file add.cpp is int add(int a,int b){return a+b;}
in my main.cpp I want the code like this
#include "github.com/xxx/add.h"
int main(){
int a = add(1,1);
}
When compile begin,compiler can auto download add.cpp from github.com
Can this happen?
No it's not going to happen (assuming you're not using some sort of fetching machinery). Only local files are included by the preprocessor with an #include
directive.
C++ doesn't work like Go or Javascript
Files hosted on github are meant to be checked out using git and then used.
I recommend reading a C++ and a Git book before continuing (or your compiler/build system manual to add extra fetching steps)
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