|
-
February 28th, 2006, 05:59 PM
#1
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
-
February 28th, 2006, 06:13 PM
#2
Re: gcc command line compiling help
-
February 28th, 2006, 06:30 PM
#3
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.
-
February 28th, 2006, 06:34 PM
#4
Re: gcc command line compiling help
Ahh, the linker itself is crashing. Got me. Have you tried re-installing it? Upgrading?
Viggy
-
February 28th, 2006, 07:20 PM
#5
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).
-
February 28th, 2006, 08:11 PM
#6
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 ...
-
February 28th, 2006, 08:29 PM
#7
Re: gcc command line compiling help
 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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|