Skip to content

Instantly share code, notes, and snippets.

@domiyanyue
Created April 25, 2020 21:44
Show Gist options
  • Save domiyanyue/7f6daf02f3707999ec5f3cbcd3b7102b to your computer and use it in GitHub Desktop.
Save domiyanyue/7f6daf02f3707999ec5f3cbcd3b7102b to your computer and use it in GitHub Desktop.
Compile multiple source files
g++ -c main.cpp -o main.o
g++ -c util.cpp -o util.o
g++ main.o util.o -o a.out
#include <iostream>
#include "util.h"
int main(){
std::cout << foo();
return 0;
}
#include "util.h"
int foo(){
return 1;
}
int foo();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment