I have a C program with a single source file. I need to get user input, so I figured I'd use readline.
Here's the abridged version of my source file, src.c:
Then I attempt to make and run it like this from bash:
I'm realizing now that I'm more reliant on an IDE than I thought I was/would like to be given I'm getting tripped up on trying to compile a single source code with a single external library that it's dependent on.
Here are a few questions I have that I suspect may get at the root problem:
1 - What is the -I argument relative to? Is there an environment variable I should set that make will use or something, akin to PYTHONPATH in Python if you want it to look for your Python modules in a specific directory (Java has a similar environment variable, although I can't think of its name off the top of my head right now.)
2 - In #include, what is that relative to?
3 - I know that OS X doesn't come with gnu readline but instead has... libedit? I know that Python just handles it - if you import readline on a platform with libedit it uses that instead. Do I need to actually change anything?
Here's the abridged version of my source file, src.c:
Code:
// ... all my other headers ...
#include <readline/readline.h>
int main(int arc, char *argv[]) {
char *input;
while ((input = readline("> ")) != NULL) {
// ... do useful stuff here
free(input);
}
return 0;
}
Then I attempt to make and run it like this from bash:
Code:
make src -Ireadline && ./src
I'm realizing now that I'm more reliant on an IDE than I thought I was/would like to be given I'm getting tripped up on trying to compile a single source code with a single external library that it's dependent on.
Here are a few questions I have that I suspect may get at the root problem:
1 - What is the -I argument relative to? Is there an environment variable I should set that make will use or something, akin to PYTHONPATH in Python if you want it to look for your Python modules in a specific directory (Java has a similar environment variable, although I can't think of its name off the top of my head right now.)
2 - In #include, what is that relative to?
3 - I know that OS X doesn't come with gnu readline but instead has... libedit? I know that Python just handles it - if you import readline on a platform with libedit it uses that instead. Do I need to actually change anything?