×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Using My Libraries in Linux

Using My Libraries in Linux

Using My Libraries in Linux

(OP)
I started bringing all of my C libraries and projects to my Linux drive. Currently I'm using Windows and the ancient Borland C 5.5 compiler. (I know. It's old, but I know it really well and it's free.)
To configure the Borland compiler to automatically look in my homemade libraries directory, I have a line in the BCC32.cfg file (where "mylibs" are my routines):

-I"C:\BC55\INCLUDE";"C:\BC55\MYLIBS"

I'm getting used to Linux (Mint), and I just started learning gcc. I just learned about the "ar" command to add my object files to a static library, but how do I get gcc to automatically check my homemade libs folder? Is there a config file for gcc? If there is I couldn't find it.

RE: Using My Libraries in Linux

https://gcc.gnu.org/onlinedocs/gcc/Environment-Var...

In your .profile/.bashrc or similar
export LIBRARY_PATH=/path/to/my/lib
export CPATH=/path/to/my/headers

--
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.

RE: Using My Libraries in Linux

(OP)
Thanks. I tried that. I copied and pasted those two lines to the end of my '.profile' file:

export LIBRARY_PATH=~/Cthings/mylibs
export CPATH=~/Cthings/mylibs


but I'm still getting "No such file or directory" errors. What am I missing?

RE: Using My Libraries in Linux

Try using say
$HOME 
rather than
~ 

Or failing that, absolute paths.

Not everything understands ~ shell magic.

--
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.

RE: Using My Libraries in Linux

(OP)
Thank you. That worked. But after I made the change to the '.profile' file, I had to reboot for it to take effect. Is there a way to reload that file without having to do that?

RE: Using My Libraries in Linux

Your .profile comes into effect when you login.

So all you need to do is logout and login again.

Also, you can re-read it by just typing in
. $HOME/.profile

--
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close