Thread: How to build lib files in windows?

  1. #1
    Registered User
    Join Date
    Oct 2011

    How to build lib files in windows?


    I am using code::blocks IDE for program development. If I have my program file (some functions without main) x.c and its function prototypes are in x.h header file. I want to create a libx.a file from this, how it can be done using this IDE under windows (using default mingw gcc compiler)?. When try to build x.c, it produces x.o file without x.exe with error message of not having main (which is natural !!!). Is this x.o file can be use to build libx.a file? If I build libx.a file, can it be used as standard library function?

    With thanks and regards,

  2. #2
    Join Date
    Aug 2010
    Ontario Canada
    Look in your MinGW documentation (if you don't have it, get it)... I believe you'll find that instead of linking it you want to use the library manager.

    Also look in Code::Blocks help documentation, I believe there is a "project type" that does this for you.

    Of course you could make your live a lot easier and get Pelles C and pick "Win32 Static Library" or "Win64 Static Library" from the project selection dialog.

  3. #3
    Registered User
    Join Date
    Oct 2011
    Thanks Tater,

    I could build libx.a file. I made one folder "own_lib", in which I further made two folders "include" and "lib". I copied libx.a file in the "lib" folder and header file x.h in the "include" folder. In code::blocks settings of library finder I added path for these folders. In scanning of "lib" folder, code::blocks generates a message that no library found. Where I did wrong? How can I use my own build libraries similar to the standard libraries in my programs?

    Thanks and regards,

  4. #4
    Registered User
    Join Date
    May 2009
    FAQ-Compiling (errors) - CodeBlocks

    I suggest turning on CB Full Compiler Logging and hope an MinGW expert sees the problem.

    Tim S.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can anyone get this to build in windows?
    By mitch88 in forum C++ Programming
    Replies: 11
    Last Post: 01-23-2011, 10:13 AM
  2. Build linux on windows
    By baash05 in forum Linux Programming
    Replies: 6
    Last Post: 02-19-2008, 10:12 PM
  3. Replies: 4
    Last Post: 10-03-2005, 04:44 PM
  4. tar files in windows
    By excess in forum Windows Programming
    Replies: 1
    Last Post: 11-01-2003, 11:58 PM
  5. Windows function for mp3 files?
    By Leeman_s in forum Windows Programming
    Replies: 4
    Last Post: 06-03-2003, 06:00 PM