Skip to content

Instantly share code, notes, and snippets.

@springmeyer
Created October 27, 2011 22:03
Show Gist options
  • Save springmeyer/1321021 to your computer and use it in GitHub Desktop.
Save springmeyer/1321021 to your computer and use it in GitHub Desktop.
test if c++ compiler and linker is working
echo '#include <string>' > lib.hpp
echo 'std::string hello();' >> lib.hpp
echo '#include "lib.hpp"' > lib.cpp
echo 'std::string hello() { return "hello world\n"; }' >> lib.cpp
echo '#include <iostream>' > test.cpp
echo '#include "lib.hpp"' >> test.cpp
echo 'int main(void) { std::cout << hello();return 0; }' >> test.cpp
g++ -o test test.cpp lib.cpp
./test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment