Author Topic: Static library "lib" prefix.  (Read 7625 times)

Offline orefa

  • Multiple posting newcomer
  • *
  • Posts: 102
Static library "lib" prefix.
« on: September 17, 2005, 03:28:30 am »
Not sure if this is normal or not, but when I compile a static library named "foo" the resulting product is named "libfoo.a", that is a "lib" prefix is prepended to the name I gave it. I deleted the prefix from the target name in the project options but c::b insists on adding it. Maybe there's a reason for it that I'm not thinking of. Is this intentional or should I report it as a bug?

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Static library "lib" prefix.
« Reply #1 on: September 17, 2005, 04:07:22 am »
That must be intentional. Libraries in GCC start with lib and have the extension .a.

When you try to link a library (specifying -lname_of_the_library) it'll try to find libname_of_the_library.a

So, don't worry, it isn't a bug.

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Static library "lib" prefix.
« Reply #2 on: September 17, 2005, 04:28:13 am »
How curious, I reported this as a bug a week ago. Yiannis fixed it in CVS so that codeblocks isn't confused with library names anymore.

Offline orefa

  • Multiple posting newcomer
  • *
  • Posts: 102
Re: Static library "lib" prefix.
« Reply #3 on: September 17, 2005, 04:45:33 am »
Yiannis fixed it in CVS

So it won't add "lib" to the library name anymore? That would be better. I just tried to link that "foo.a" in another project but the linker was not actually looking for "libfoo.a" so I had to rename it. A minor problem, but it's better solved than not. :)

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Static library "lib" prefix.
« Reply #4 on: September 17, 2005, 11:52:23 am »
Yiannis fixed it in CVS

So it won't add "lib" to the library name anymore? That would be better. I just tried to link that "foo.a" in another project but the linker was not actually looking for "libfoo.a" so I had to rename it. A minor problem, but it's better solved than not. :)


Yes, it's fixed.
Be patient!
This bug will be fixed soon...

Offline severach

  • Multiple posting newcomer
  • *
  • Posts: 44
Re: Static library "lib" prefix.
« Reply #5 on: September 23, 2005, 07:34:01 am »
The reason you prepend lib and postpend .a onto the specified file is so all compilers can use the same lib names and the lib tool adapts to the proper names. I should be able to specify the following standard libs without having to change them for each compiler I use.

shell32 (shell32.lib libshell32.a)
user32
shlwapi
C:\Program Files\CodeBlocks\lib\foo.a

If you use the full path for the lib, C::B does not add anything. There should be a less drastic way to get C::B to drop prefixes and suffixes. I end up with .o/.obj problems too. It seems that C::B stores a default lib/obj extension for each compiler but I can't find where to change it.

zieQ

  • Guest
Re: Static library "lib" prefix.
« Reply #6 on: September 23, 2005, 08:05:53 am »
I end up with .o/.obj problems too. It seems that C::B stores a default lib/obj extension for each compiler but I can't find where to change it.

There's none actually, the prefix and extension are hardcoded into the compiler plugin. This will be subject to changes in the compiler revamp after v1.0  :wink:

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Static library "lib" prefix.
« Reply #7 on: September 23, 2005, 09:32:56 am »
It 's in Settings->Compiler->Other->Advanced options.
Be patient!
This bug will be fixed soon...