0

I learnt in this question, hearder and library, that a library is a set of compiled object files. If this is true, where exactly can I find a library, for example, the library referred by iostream, in a certain computer? Does it lie in some system folder? And does the compiler has such a rule for finding libraries: it goes to some default system folder to look for libraries with a header enclosed by <>, and it looks for libraries with a header enclosed by "" in the current working folder?

Community
  • 1
  • 1
Felix
  • 209
  • 1
  • 3
  • 8
  • 1
    Start by telling us your compiler and what OS you are using. – drescherjm Jan 06 '17 at 13:58
  • @drescherjm I mean in some certain computer. I have corrected my words. – Felix Jan 06 '17 at 14:00
  • Generally go goes wherever you compiled it to be or where the program decides to install them. In that case normally they are in the program folder. – NathanOliver Jan 06 '17 at 14:02
  • 1
    The reason I asked is linux or macOS there are specific locations where libraries and headers are supposed to be installed however windows does not define any location so these can be anywhere. – drescherjm Jan 06 '17 at 14:04

2 Answers2

1

Exactly. The libraries and their headers are held in some system or compiler-dependent location, usually a system-dependent one. The compiler then has to be told the paths. On Unix it tends to be /usr/lib but you can't be sure - everything is configurable with multiple environmental variables and compiler switches.

If you can't find a library or you are linking to two libraries of the same source compilers will complain, and you have to set up the options and occasionally install the libraries are packages. Search paths for headers and object code are often different.

Unix libraries take the suffix .a or .so, Windows ones .lib or .dll

Quentin
  • 62,093
  • 7
  • 131
  • 191
Malcolm McLean
  • 6,258
  • 1
  • 17
  • 18
0

Where exactly can I find a library?

If you are using windows libraries then can be found in System and windows folders, If you are using any installed program specific library then can be found in installation folder, You can search for library in your computer. While loading library we need to specify path/location.

Please look at MSDN function to load library MSDN Load library

Petter Hesselberg
  • 5,062
  • 2
  • 24
  • 42
Rohan J Mohite
  • 2,283
  • 10
  • 19