Created
April 25, 2020 21:44
-
-
Save domiyanyue/7f6daf02f3707999ec5f3cbcd3b7102b to your computer and use it in GitHub Desktop.
Compile multiple source files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
g++ -c main.cpp -o main.o | |
g++ -c util.cpp -o util.o | |
g++ main.o util.o -o a.out |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include "util.h" | |
int main(){ | |
std::cout << foo(); | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "util.h" | |
int foo(){ | |
return 1; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int foo(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment