c++ - g++ when compile and link multiple files -


I have a G ++ compilation / link problem I want to implement a dynamic array. I separated the definition and implementation of my class into "DARRHH" and "DARRCAPPP" files. And test the "DArraytest.cpp" file that contains a main function.

All files are in the same directory, and I use the following command to compile g ++ * .ppp

But it still gives me this kind of link error Returns the /tmp/cc4tu73o.o: __static_initialization_and_destruction_0 (int, int) '' in the function: DArray.cpp :(. Text + 0x1d): Unspecified context for std :: Ios_base :: init: : init () 'DArray.cpp :( text + 0x34): std :: ios_base :: init :: ~ Init ()' /tmp/ccdHUZjJ.o 'reference to the undefined reference: in the function DArray & lt; Int & gt; Undefined reference to: DArray () '' DARRATPP: (.text + 0x2e): DARRA :: End (int. Const & amp;) 'DARArtist CPP: (.text + 0x4a): DARRA & Lt; Int and GT :: Append (Int cost and 'DARArtist CPP: 0x66): DARRA :: Append (Int cost and amp); Undefined reference for DARRTest CPP: (.text + 0x82): DARRA and lieutenant; Int & gt; :: Append (Int cost & amp; DArraytest.c; PP: (. + Text + 0xa3): Undefined reference to: std :: cout 'DARTRTPPP: (.text + 0xa8): std :: ostream :: Operator & lt; & lt; (int) 'DArraytest.cpp :(. Text + 0xb0): std :: basic_ostream & gt; Undefined reference to Std :: endl> (std :: basic_ostream & gt; & amp;; 'DArraytest.cpp :( .text + 0xb8): std :: ostream :: operator DARRA :: ~ DARRA (DARRT) CPP: (.text + 0xeb) Refine Reference: In the context of the undefined DArray & lt; int> gt; :: DArray () '/tmp/ccdHUZjJ.o: in the function __static_initialization_and_destruction_0 (int, int)': DArraytest.cpp: (.text + 0x11d): Undefined reference to std :: ios_base :: init :: init () 'DArraytest.cpp :( .text + 0x134): std :: ios_base :: init:

P>

I think you must provide all .cpp file names for G ++. To avoid this, you can create a makefile which automatically has all the same compilation rules. Can apply to CPP files

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -