PATH for include files

New to FreeBASIC? Post your questions here.
Post Reply
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

PATH for include files

Post by VANYA »

Hi ALL!

In the build under windows "standalone" the paths are placed like this:

fbc
bin\
include\
lib\

And on linux paths are already arranged differently:

bin\fbc
include\freebasic\
lib\freebasic

Is it possible to programmatically find out the path to the included files? Can eat any macro about which I do not know?
marcov
Posts: 3455
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: PATH for include files

Post by marcov »

Usually such changes are hardcoded defines set with an #ifdef.
ecxjoe
Posts: 96
Joined: Aug 08, 2009 6:01
Location: Utah, USA
Contact:

Re: PATH for include files

Post by ecxjoe »

Probably best to not rely on those paths in your program. This should be something configured on a system or compiler level: they should already be in your path or passed as an option when compiling.
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: PATH for include files

Post by VANYA »

Thanks guys for answers! I thought that there might be some kind of macro or command. Okay, I have to set the hard path to this directory.
speedfixer
Posts: 606
Joined: Nov 28, 2012 1:27
Location: CA, USA moving to WA, USA
Contact:

Re: PATH for include files

Post by speedfixer »

Vanya

There are several descriptions for 'standard' or typical library organizations for Linux. Search the web. Each OS may still use some other organization.

Linux has several methods to locate or list paths.
Of course, you do have to go to the OS.

'which' is the most used command in console to find an executable, though it only searches in the established paths, and may not indicate when one is an alias.

'find' is much more complex, beyond a quick explanation.
'ldconfig' will control most linker paths and library caches. Study that command.

Simply:
which fbc
will tell you where the fbc executable is located.

Wrap the query in an open pipe or some other system command.

Code: Select all

dim as integer fnum
dim as string result

fnum = freefile
open pipe "which fbc" for input as fnum
input #fnum, result
close fnum

print result


/usr/local/bin/fbc
Library calls are are a little more difficult: each language may have its own method to locate its library.

In a console, enter 'env' to see the usual sets of paths - per this instance of your user.

For YOUR programs, develop your own standard, then soft-code locations and make a small utility function that tests/verifies your program got installed as you intended, or some other sensible way according to your expectations.


David
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: PATH for include files

Post by VANYA »

Thank you speedfixer , I will definitely try this method.
marcov
Posts: 3455
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: PATH for include files

Post by marcov »

speedfixer wrote: There are several descriptions for 'standard' or typical library organizations for Linux. Search the web. Each OS may still use some other organization.
(traditional unix has this in the "hier" manpage, short for hierarchy, try "man hier")
Post Reply