Author Topic: Building a library with Microsofts lib.exe  (Read 5153 times)

Offline dennosaurus

  • Single posting newcomer
  • *
  • Posts: 6
Building a library with Microsofts lib.exe
« on: July 23, 2011, 05:41:26 am »
 :(I am attempting to build a static library using Microsoft's lib.exe in Code Blocks. Code Blocks insists on adding the link libraries and options to the lib.exe command, thus ruining my build. Lib.exe is not link.exe and none of the link libraries or options should appear in the lib.exe command. Lib.exe has it's own set of commands. Is there any way I can stop Code Blocks from doing this?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Building a library with Microsofts lib.exe
« Reply #1 on: July 23, 2011, 05:42:48 am »
What is the type of the project? (Project -> Properties -> Build Targets -> Type)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline dennosaurus

  • Single posting newcomer
  • *
  • Posts: 6
Re: Building a library with Microsofts lib.exe
« Reply #2 on: July 23, 2011, 12:48:39 pm »
Type of project is Library.

Offline dennosaurus

  • Single posting newcomer
  • *
  • Posts: 6
Re: Building a library with Microsofts lib.exe
« Reply #3 on: July 23, 2011, 12:55:58 pm »
Type of project is Static Library. Build software is Microsoft 2010 x32.

Offline dennosaurus

  • Single posting newcomer
  • *
  • Posts: 6
Re: Building a library with Microsofts lib.exe
« Reply #4 on: July 23, 2011, 01:18:01 pm »
I have also created a Static Library target that uses Microsoft's VC6 build software. This uses link.exe to build the library and requires the link option -LIB. Code Blocks adds /LIB instead of -LIB, causing an error. It also is adding the global link libraries, library paths, and options to the command which it should not do.

zabzonk

  • Guest
Re: Building a library with Microsofts lib.exe
« Reply #5 on: July 23, 2011, 01:43:31 pm »
The link.exe command, like all MS programs, uses slashes to indicate options, so /LIB is correct.

Offline dennosaurus

  • Single posting newcomer
  • *
  • Posts: 6
Re: Building a library with Microsofts lib.exe
« Reply #6 on: July 24, 2011, 03:28:43 am »
The solution. I created a new compiler entry in Settings/ which is a copy of the compiler entry I was using and named it Library compiler. Then I removed the link libraries, link options, and linker paths from the Library compiler. By using this compiler in my target I get a reasonable lib.exe command. Lib.exe still complains about the /LIB option that Codeblocks adds but it builds correctly.