Create a .o file:
g++ -c header.cpp
add this file to a library, creating library if necessary:
ar rvs header.a header.o
use library:
g++ main.cpp header.a
More Related Contents:
- Update GCC on OSX
- Why does flowing off the end of a non-void function without returning a value not produce a compiler error?
- Undefined reference to vtable
- What is the difference between g++ and gcc?
- How does #include work in C++? [duplicate]
- Compiling a C++ program with GCC
- Why does typeid.name() return weird characters using GCC and how to make it print unmangled names?
- What is the purpose of using -pedantic in the GCC/G++ compiler?
- gcc/g++: “No such file or directory”
- 😃 (and other Unicode characters) in identifiers not allowed by g++
- constexpr initializing static member using static function
- How to tell where a header file is included from?
- How to include omp.h in OS X?
- Linking g++ 4.8 to libstdc++
- Linking to MSVC DLL from MinGW
- Compiling with g++ using multiple cores
- GNU C++ how to check when -std=c++0x is in effect?
- g++ How to get warning on ignoring function return value
- request for member `…’ is ambiguous in g++
- Why include guards?
- Template instantiation details of GCC and MS compilers
- GCC: Difference between -O3 and -Os
- Why “initializer-string for array of chars is too long” compiles fine in C & not in C++?
- Does the restrict keyword provide significant benefits in gcc/g++?
- Install gcc on linux with no root privilege
- Fun with uninitialized variables and compiler (GCC)
- Undocumented GCC Extension: VLA in struct
- How should I use g++’s -finput-charset compiler option correctly in order to compile a non-UTF-8 source file?
- Can I make GCC warn on passing too-wide types to functions?
- List of common C++ Optimization Techniques [closed]