PATH for include files

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

PATH for include files

Postby VANYA » Oct 30, 2017 9:09

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: 2399
Joined: Jun 16, 2005 9:45
Location: Eindhoven, NL
Contact:

Re: PATH for include files

Postby marcov » Oct 30, 2017 9:10

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

Re: PATH for include files

Postby ecxjoe » Oct 30, 2017 15:38

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: 1255
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: PATH for include files

Postby VANYA » Oct 30, 2017 18:13

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: 248
Joined: Nov 28, 2012 1:27
Location: California

Re: PATH for include files

Postby speedfixer » Nov 01, 2017 20:55

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: 1255
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: PATH for include files

Postby VANYA » Nov 03, 2017 15:01

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

Re: PATH for include files

Postby marcov » Nov 03, 2017 15:36

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")

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 1 guest