CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    May 2003
    Posts
    424

    gcc command line compiling help

    I'm trying to make a batch file to build libbz2.a. Here is what I have so far, but I must be doing something wrong because when I try to link to libbz2.a I get a fatal error from the linker and it is killed.

    "..\0_CodeBlocks\bin\gcc" -w -O1 -O2 -O3 -Os -c blocksort.c
    "..\0_CodeBlocks\bin\gcc" -w -O1 -O2 -O3 -Os -c huffman.c
    "..\0_CodeBlocks\bin\gcc" -w -O1 -O2 -O3 -Os -c crctable.c
    "..\0_CodeBlocks\bin\gcc" -w -O1 -O2 -O3 -Os -c randtable.c
    "..\0_CodeBlocks\bin\gcc" -w -O1 -O2 -O3 -Os -c compress.c
    "..\0_CodeBlocks\bin\gcc" -w -O1 -O2 -O3 -Os -c decompress.c
    "..\0_CodeBlocks\bin\gcc" -w -O1 -O2 -O3 -Os -c bzlib.c
    "..\0_CodeBlocks\bin\gcc" -w -O1 -O2 -O3 -Os -c bzip2.c
    "..\0_CodeBlocks\bin\gcc" -w -O1 -O2 -O3 -Os -c bzip2recover.c
    "..\0_CodeBlocks\bin\gcc" -w -O1 -O2 -O3 -Os blocksort.o huffman.o crctable.o randtable.o compress.o decompress.o bzlib.o bzip2.o -o "Release\libbz2.a"
    pause

  2. #2
    Join Date
    Feb 2002
    Posts
    4,640

    Re: gcc command line compiling help

    What is the error?

  3. #3
    Join Date
    May 2003
    Posts
    424

    Re: gcc command line compiling help

    It's not a compiler error, it's an unhandled exeption. It occurs when gcc tries to use ld.exe to access the file. Let me make this clear, the exception occurs AFTER the script above is done and I try to use the newly compiled lib file using CodeBlocks and gcc.

  4. #4
    Join Date
    Feb 2002
    Posts
    4,640

    Re: gcc command line compiling help

    Ahh, the linker itself is crashing. Got me. Have you tried re-installing it? Upgrading?

    Viggy

  5. #5
    Join Date
    May 2003
    Posts
    424

    Re: gcc command line compiling help

    Nope, that's not the problem. Everything else builds and runs fine when I exclude that library (and the accompanying code to make it compile without the library).

  6. #6
    Join Date
    May 2003
    Location
    San Antonio TX
    Posts
    380

    Re: gcc command line compiling help

    I have never used gcc to build a static library. ar is the tool that we use.

    After all the .o's are built, put them all in a .a file with ar.


    -Kendall
    John 3:16
    For God so loved the world ...

  7. #7
    Join Date
    Apr 1999
    Posts
    27,449

    Re: gcc command line compiling help

    Quote Originally Posted by aewarnick
    Nope, that's not the problem. Everything else builds and runs fine when I exclude that library (and the accompanying code to make it compile without the library).
    You could try the Dev-C++ package which uses gcc and linker to compile and build libraries. If you create a project with the files, and it builds correctly, you can examine how Dev-C++ accomplished it by looking at the command line it invoked.

    Regards,

    Paul McKenzie

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured