How to build lib files in windows?

This is a discussion on How to build lib files in windows? within the C Programming forums, part of the General Programming Boards category; Hello, I am using code::blocks IDE for program development. If I have my program file (some functions without main) x.c ...

  1. #1
    Registered User
    Join Date
    Oct 2011
    Posts
    19

    How to build lib files in windows?

    Hello,

    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,
    Amal.

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    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
    Posts
    19
    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,
    Amal....

  4. #4
    Registered User
    Join Date
    May 2009
    Posts
    2,514
    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, 09:13 AM
  2. Build linux on windows
    By baash05 in forum Linux Programming
    Replies: 6
    Last Post: 02-19-2008, 09: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, 10: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21