Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: dennosaurus on July 23, 2011, 05:41:26 am

Title: Building a library with Microsofts lib.exe
Post by: dennosaurus 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?
Title: Re: Building a library with Microsofts lib.exe
Post by: oBFusCATed on July 23, 2011, 05:42:48 am
What is the type of the project? (Project -> Properties -> Build Targets -> Type)
Title: Re: Building a library with Microsofts lib.exe
Post by: dennosaurus on July 23, 2011, 12:48:39 pm
Type of project is Library.
Title: Re: Building a library with Microsofts lib.exe
Post by: dennosaurus on July 23, 2011, 12:55:58 pm
Type of project is Static Library. Build software is Microsoft 2010 x32.
Title: Re: Building a library with Microsofts lib.exe
Post by: dennosaurus 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.
Title: Re: Building a library with Microsofts lib.exe
Post by: zabzonk 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.
Title: Re: Building a library with Microsofts lib.exe
Post by: dennosaurus 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.