Author Topic: Questions on using (standard) libraries  (Read 4383 times)

Offline Samuel G.

  • Multiple posting newcomer
  • *
  • Posts: 17
Questions on using (standard) libraries
« on: December 20, 2006, 11:51:47 am »
I have a few question about my manual installed nightly build of Code::Blocks:

1. Why does it work without a standard library installed and added to the include files?
2. Why is it possible to set directories for .lib files even though you have to add a .lib library to the project anyway?
3. When building a DLL, is it possible to set a different output file for the .dll and for the .lib, and is it possible to set more than one output directories for the .dll (for every project using the .dll).

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7790
    • My Best Post
Re: Questions on using (standard) libraries
« Reply #1 on: December 20, 2006, 04:10:10 pm »
What version of Code::Blocks are you using R2 or Nightly Build?

I have a few question about my manual installed nightly build of Code::Blocks:

1. Why does it work without a standard library installed and added to the include files?
This is a compiler question in my opinion, so I think you need to state if you are using minGW GCC or something else. Also, some code does NOT need include files. Note, I use the term standard headers or include NOT standard library; because I think of standard library only being used in the linking. Note, many people use it as including standard library, but then you are not clear if they mean #include or a link use of the Library.

2. Why is it possible to set directories for .lib files even though you have to add a .lib library to the project anyway?
This is a basic compiler question in my opinion, you need to understand the basic, the directory is where it looks for the libraries that are listed. Note, some compilers will look other places that listed in order to find libraries.

3. When building a DLL, is it possible to set a different output file for the .dll and for the .lib, and is it possible to set more than one output directories for the .dll (for every project using the .dll).

Look at post build steps to copy files to different locations.
"Project" -> "Build Options" Tab "Commands" "post build steps"

Tim S
« Last Edit: December 20, 2006, 04:14:08 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Questions on using (standard) libraries
« Reply #2 on: December 20, 2006, 05:34:23 pm »
Quote
1. Why does it work without a standard library installed and added to the include files?
Why not? As long as you don't use any standard library functions, there is no reason why it should not work.
Adding include paths for well-known include files is not necessary, as the compiler already knows them, and with gcc, it is not even necessary to include certain headers at all, at least in C mode, as the compiler fills in builtin intrinsics (this is bad style, though).

Quote
2. Why is it possible to set directories for .lib files even though you have to add a .lib library to the project anyway?
Because that makes sense? I would not want to hardcode absolute paths into my projects, think of what happens if you move to another hard drive.

Quote
3. When building a DLL, is it possible to set a different output file for the .dll and for the .lib, and is it possible to set more than one output directories for the .dll (for every project using the .dll)
No, this is somewhat beyond the scope of our build system, and it does not make sense to me either.
However, if you absolutely think that you must have a dozen copies of your DLL, you can implement this using a post-build step, no problem.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."