ScKaSx said:
Issue 1:
I have a header file called tnt.h, which I want to evoke in my code. However, I can't seem to run it if it's in the same directory. I figured if I could put it where the other libraries are: stdio.h, etc. I could run it. Is this false thinking, if so WHAT do I do, and if not, WHERE do I save the libraries.
Mark, I am using a makefile. I believe the libraries are statically linked (what does that mean off-hand, that I'm changing the libraries?) Thanks.
Issue 2:
The command is called "plot". It's under the GNU plot utilites which is apparently on PC's stock, whereas it is not on the mac. I am trying to use old code from a PC on my mac, which is why I wanted this command.
Cheers
If you want to use tnt.h, from the same directory as your source files, then do this:
Code:
#include <stdio.h>
#include "tnt.h"
int main(int argc, char *argv[]) {
...
}
Alternatively, there is an argument to gcc, I think
-I to add another directory to the include path. So, if tnt.h is somewhere else, then do:
gcc -I/path/to/tnt-includes myfile.cpp
In this case you'd still do:
#include <tnt.h>
Keep in mind that the header file usually just gives function prototypes. The actual code is in .cpp files, and can be assembled into a static library library with a .lib extension, or a dynamic library with a .so or .dynlib (I think) extension. So, when compiling you're trying to use the right header file, and when linking you're trying to use the right library. I think gcc has
-L and
-l (lowercase L) arguements to specify the library directory, and library name, respectively. For example, on some platforms, if you use sockets, you give a
-lsocket argument to the linker. The
-L/path/to/libraries argument is typically not necessary for socket or math libraries because they're in some standard location that's already on the library search path.
The difference between static libraries and shared libraries is that static libraries become part of your executable. On Win32, your .exe file would contain that code. Shared libraries on Win32 are .dll files, which your .exe connects to at runtime.
Now, you refer to the "plot"
command. Do you mean command line program, or do you mean C/C++ function?