Last active
August 29, 2015 14:26
-
-
Save JohannesMP/8fa140b60b8ffeb2cae0 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# located in root | |
# cd into project directory | |
cd ${0%/*} | |
# compile library | |
clang++ -Wall -dynamiclib lib_src/myprint.cpp -o myprint.dylib | |
# compile main object file | |
clang++ -Wall -c main_src/main.cpp -I ./lib_src -o main.o | |
# link main object file and dylib | |
clang++ -Wall main.o myprint.dylib -o main |
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
// Located in root/main_src | |
#include "../lib_src/print_lib.h" | |
int main(int argc, char **argv) | |
{ | |
lib_print("HELLO WORLD"); | |
} |
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
// Located in root/lib_src | |
#include <iostream> | |
#include "print_lib.h" | |
void lib_print(const char *input) | |
{ | |
std::cout << "lib_print: " << input << std::endl; | |
} |
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
// Located in root/lib_src | |
#pragma once | |
void lib_print(const char *input); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment