Re: not-so-basic gcc question [was very basic gcc question]



;-)

For those who are interested:

In any case I had a sudden revelation this morning:  the code compiled fine, but didn't link.  For C++ code, these are equivalent (as far as I can tell):

g++ foo.cc
gcc -xc++ -lstdc++ foo.cc


As for the Java, gcc -xjava -c Foo.java will compile the Java to a .o object file.  I found that there is a program,   /usr/lib/gcc-lib/i386-redhat-linux/2.96/jvgenmain , that takes a class name as an argument and writes C code for main to stdout.  this main can then be compiled and linked with the other object files.

gcj --main=Foo Foo.java

is the same as

gcc -xjava -c Foo.java 
 /usr/lib/gcc-lib/i386-redhat-linux/2.96/jvgenmain Foo > main.c
gcc -lgcj -lgcjgc -lpthread -lzgcj main.c Foo.o 


The following also seem to be equivalent:

gcc -xjava -c Foo.java
gcj -c Foo.java

I don't think you can create .class file using the gcc command.

-D



On Wed, 08 Nov 2000 09:29:33 Havoc Pennington wrote:
 | 
 | D-Man <dsh8290 rit edu> writes: 
 | > What is the intended purpose of redefining "GCC" and the -x option?  Am I
 | > using it in the wrong way?
 | > 
 | 
 | If you guys were having this discussion on a more appropriate mailing
 | list, there might be someone on said list who knew the answer. ;-)
 | No gcc experts on this one AFAIK. Try:
 | 
 |   http://gcc.gnu.org/lists.html
 | 
 | Also there are some C programming lists out there.
 | 
 | Havoc
 | 
 | _______________________________________________
 | gtk-list mailing list
 | gtk-list gnome org
 | http://mail.gnome.org/mailman/listinfo/gtk-list
 | 






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]