help-gplusplus
[Top][All Lists]
Advanced

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

Question of compile C++ code with g++


From: Sen-Lung Chen
Subject: Question of compile C++ code with g++
Date: 2 Aug 2005 09:54:50 -0700
User-agent: G2/0.2

Dear All:
I have question about how to compile those below code.
The architecture is as below:


Independent:
caluating.cc , reading.cc, ran_gen.cc, hamming.cc, sorting.cc,
combine.cc
-----------
Dependency:
find_column.cc   self + hamming.cc, sorting.cc
counting.cc      self + hamming.cc, count.cc
write.cc         self, hamming.cc
rem_routine.cc   self, hamming.cc, combine.cc


solving.cc       self,
counting.cc+find_column.cc+ran-_gen.cc+sorting.cc


main.cc          self+reading.cc+ran_gen.cc+wri-te.cc+rem_routine.cc +

solving.cc


I write the main function in main.cc , other programs are describle
some other function.


---------------


I try to compile hamming.cc and write.cc to create hamming.o and
write.o
g++ -c hamming.cc ; this pass, no error.
However, when I compile write.cc , there are some error; I try three
method, but all fail.
1.g++ -c write.cc hamming.o
  error message:


  g++: hamming.o: linker input file unused because linking not done


2.g++ write.cpp hamming.o -o write


  : undefined reference to `main'


3.g++ -c write.cpp hamming.o -o write


g++: cannot specify -o with -c or -S and multiple compilations


I don't know how to compile those code to a executable file.


Thank you for helping. 


                          Sen-Lung



reply via email to

[Prev in Thread] Current Thread [Next in Thread]