使用优化级别编译C ++项目

时间:2013-11-15 10:02:14

标签: c++ compiler-optimization

我没有我的C ++项目,我可以使用这一行成功编译: g++ -o minit minit.c MinitGlobal.h Item.c ItemsetQueue.c Transaction.c Error.h Dataset.c SubDataset.c RankItems.c MinitAlgo.c但如果我添加如下所示的优化级别(-O3相同):

[ec2-user@ip-10-209-16-177 minit++]$ g++ -o -O0 minit minit.c MinitGlobal.h Item.c ItemsetQueue.c Transaction.c Error.h Dataset.c SubDataset.c RankItems.c MinitAlgo.c
minit: In function `_start':
(.text+0x2a8): multiple definition of `_start'
/usr/lib/gcc/x86_64-amazon-linux/4.6.3/../../../../lib64/crt1.o:(.text+0x0): first defined here
minit: In function `_fini':
(.fini+0x0): multiple definition of `_fini'
/usr/lib/gcc/x86_64-amazon-linux/4.6.3/../../../../lib64/crti.o:(.fini+0x0): first defined here
minit:(.rodata+0x0): multiple definition of `_IO_stdin_used'
/usr/lib/gcc/x86_64-amazon-linux/4.6.3/../../../../lib64/crt1.o:(.rodata.cst4+0x0): first defined here
minit: In function `__data_start':
(.data+0x0): multiple definition of `__data_start'
/usr/lib/gcc/x86_64-amazon-linux/4.6.3/../../../../lib64/crt1.o:(.data+0x0): first defined here
minit:(.rodata+0x8): multiple definition of `__dso_handle'
/usr/lib/gcc/x86_64-amazon-linux/4.6.3/crtbegin.o:(.rodata+0x0): first defined here
minit: In function `_init':
(.init+0x0): multiple definition of `_init'
/usr/lib/gcc/x86_64-amazon-linux/4.6.3/../../../../lib64/crti.o:(.init+0x0): first defined here
/tmp/cc0cvoT6.o: In function `main':
minit.c:(.text+0x4d2): multiple definition of `main'
minit:(.text+0x0): first defined here
/tmp/ccRfRvQv.o:(.bss+0x0): multiple definition of `minit::Itemset::count'
minit:(.bss+0x638): first defined here
/tmp/ccQhesuV.o: In function `minit::ItemsetQueue::ItemsetQueue()':
ItemsetQueue.c:(.text+0x0): multiple definition of `minit::ItemsetQueue::ItemsetQueue()'
minit:(.text+0x390): first defined here
/tmp/ccQhesuV.o: In function `minit::ItemsetQueue::enqueue(unsigned int const&, unsigned int)':
ItemsetQueue.c:(.text+0x7e): multiple definition of `minit::ItemsetQueue::enqueue(unsigned int const&, unsigned int)'
minit:(.text+0x430): first defined here
/tmp/ccQhesuV.o: In function `minit::ItemsetQueue::enqueue(minit::Itemset const&, unsigned int const&, unsigned int)':
ItemsetQueue.c:(.text+0xfe): multiple definition of `minit::ItemsetQueue::enqueue(minit::Itemset const&, unsigned int const&, unsigned int)'
minit:(.text+0x520): first defined here
/tmp/ccQhesuV.o: In function `minit::ItemsetQueue::dequeue()':
ItemsetQueue.c:(.text+0x186): multiple definition of `minit::ItemsetQueue::dequeue()'
minit:(.text+0x3b0): first defined here
/tmp/ccQhesuV.o: In function `minit::ItemsetQueue::print(std::basic_ostream<char, std::char_traits<char> >&) const':
ItemsetQueue.c:(.text+0x1f2): multiple definition of `minit::ItemsetQueue::print(std::basic_ostream<char, std::char_traits<char> >&) const'
minit:(.text+0x6d0): first defined here
/tmp/ccQhesuV.o: In function `minit::ItemsetQueue::printItemsets(std::basic_ostream<char, std::char_traits<char> >&) const':
ItemsetQueue.c:(.text+0x306): multiple definition of `minit::ItemsetQueue::printItemsets(std::basic_ostream<char, std::char_traits<char> >&) const'
minit:(.text+0xa60): first defined here
/tmp/ccQhesuV.o: In function `minit::ItemsetQueue::ItemsetQueue()':
ItemsetQueue.c:(.text+0x0): multiple definition of `minit::ItemsetQueue::ItemsetQueue()'
minit:(.text+0x390): first defined here
/tmp/cc6ZqTIl.o: In function `minit::Transaction::readTransaction(std::basic_istream<char, std::char_traits<char> >&)':
Transaction.c:(.text+0x0): multiple definition of `minit::Transaction::readTransaction(std::basic_istream<char, std::char_traits<char> >&)'
minit:(.text+0x16b0): first defined here
/tmp/cc6ZqTIl.o: In function `minit::Transaction::readValue(std::basic_istream<char, std::char_traits<char> >&)':
Transaction.c:(.text+0x14a): multiple definition of `minit::Transaction::readValue(std::basic_istream<char, std::char_traits<char> >&)'
minit:(.text+0x15b0): first defined here
/tmp/ccZandoO.o: In function `minit::Dataset::Dataset(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
Dataset.c:(.text+0x0): multiple definition of `minit::Dataset::Dataset(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
minit:(.text+0x29b0): first defined here
/tmp/ccZandoO.o: In function `minit::Dataset::readDataset(std::basic_istream<char, std::char_traits<char> >&)':
Dataset.c:(.text+0x644): multiple definition of `minit::Dataset::readDataset(std::basic_istream<char, std::char_traits<char> >&)'
minit:(.text+0x2350): first defined here
/tmp/ccZandoO.o: In function `minit::Dataset::~Dataset()':
Dataset.c:(.text+0x512): multiple definition of `minit::Dataset::~Dataset()'
minit:(.text+0x1af0): first defined here
/tmp/ccZandoO.o: In function `minit::Dataset::toString() const':
Dataset.c:(.text+0x7f0): multiple definition of `minit::Dataset::toString() const'
minit:(.text+0x1c00): first defined here
/tmp/ccZandoO.o: In function `minit::Dataset::printColumnInfo()':
Dataset.c:(.text+0x9d6): multiple definition of `minit::Dataset::printColumnInfo()'
minit:(.text+0x2200): first defined here
/tmp/ccZandoO.o: In function `minit::Dataset::Dataset(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
Dataset.c:(.text+0x0): multiple definition of `minit::Dataset::Dataset(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
minit:(.text+0x29b0): first defined here
/tmp/ccZandoO.o: In function `minit::Dataset::~Dataset()':
Dataset.c:(.text+0x512): multiple definition of `minit::Dataset::~Dataset()'
minit:(.text+0x1af0): first defined here
/tmp/cc3PBOXh.o: In function `minit::SubDataset::SubDataset(minit::Dataset const&)':
SubDataset.c:(.text+0x0): multiple definition of `minit::SubDataset::SubDataset(minit::Dataset const&)'
minit:(.text+0x3c20): first defined here
/tmp/cc3PBOXh.o:(.bss+0x0): multiple definition of `minit::SubDataset::count'
minit:(.bss+0x670): first defined here
/tmp/cc3PBOXh.o:(.bss+0x10): multiple definition of `minit::SubDataset::preComputeCallsPerMaxc'
minit:(.bss+0x650): first defined here
/tmp/cc3PBOXh.o: In function `minit::SubDataset::SubDataset(minit::SubDataset const&)':
SubDataset.c:(.text+0x11a): multiple definition of `minit::SubDataset::SubDataset(minit::SubDataset const&)'
minit:(.text+0x3360): first defined here
/tmp/cc3PBOXh.o: In function `minit::SubDataset::~SubDataset()':
SubDataset.c:(.text+0x1b8): multiple definition of `minit::SubDataset::~SubDataset()'
minit:(.text+0x33f0): first defined here
/tmp/cc3PBOXh.o: In function `minit::SubDataset::~SubDataset()':
SubDataset.c:(.text+0x1b8): multiple definition of `minit::SubDataset::~SubDataset()'
minit:(.text+0x33f0): first defined here
/tmp/cc3PBOXh.o: In function `minit::SubDataset::supportSet(unsigned int) const':
SubDataset.c:(.text+0x242): multiple definition of `minit::SubDataset::supportSet(unsigned int) const'
minit:(.text+0x33a0): first defined here
/tmp/cc3PBOXh.o: In function `minit::SubDataset::preComputeSupportSets(minit::RankItems const&, int, int, int)':
SubDataset.c:(.text+0x2ac): multiple definition of `minit::SubDataset::preComputeSupportSets(minit::RankItems const&, int, int, int)'
minit:(.text+0x40d0): first defined here
/tmp/cc3PBOXh.o: In function `minit::SubDataset::preComputeSupportSetsLeafNode(minit::RankItems const&, unsigned int, unsigned int)':
SubDataset.c:(.text+0x514): multiple definition of `minit::SubDataset::preComputeSupportSetsLeafNode(minit::RankItems const&, unsigned int, unsigned int)'
minit:(.text+0x3f30): first defined here
/tmp/cc3PBOXh.o: In function `minit::SubDataset::SubDataset(minit::SubDataset const&)':
SubDataset.c:(.text+0x11a): multiple definition of `minit::SubDataset::SubDataset(minit::SubDataset const&)'
minit:(.text+0x3360): first defined here
/tmp/cc3PBOXh.o: In function `minit::SubDataset::doneWithAnchorItem(unsigned int const&)':
SubDataset.c:(.text+0x6a0): multiple definition of `minit::SubDataset::doneWithAnchorItem(unsigned int const&)'
minit:(.text+0x37e0): first defined here
/tmp/cc3PBOXh.o: In function `minit::SubDataset::SubDataset(minit::Dataset const&)':
SubDataset.c:(.text+0x0): multiple definition of `minit::SubDataset::SubDataset(minit::Dataset const&)'
minit:(.text+0x3c20): first defined here
/tmp/ccWMQMqM.o: In function `minit::RankItems::RankItems(minit::Dataset const&)':
RankItems.c:(.text+0x0): multiple definition of `minit::RankItems::RankItems(minit::Dataset const&)'
minit:(.text+0x56c0): first defined here
/tmp/ccWMQMqM.o:(.bss+0x0): multiple definition of `minit::RankItems::count'
minit:(.bss+0x680): first defined here
/tmp/ccWMQMqM.o: In function `minit::RankItems::RankItems(minit::SubDataset&, int, minit::RankItems const&, int, unsigned int)':
RankItems.c:(.text+0x1fa): multiple definition of `minit::RankItems::RankItems(minit::SubDataset&, int, minit::RankItems const&, int, unsigned int)'
minit:(.text+0x5990): first defined here
/tmp/ccWMQMqM.o: In function `minit::RankItems::toString() const':
RankItems.c:(.text+0x4e0): multiple definition of `minit::RankItems::toString() const'
minit:(.text+0x5130): first defined here
/tmp/ccWMQMqM.o: In function `minit::RankItems::RankItems(minit::Dataset const&)':
RankItems.c:(.text+0x0): multiple definition of `minit::RankItems::RankItems(minit::Dataset const&)'
minit:(.text+0x56c0): first defined here
/tmp/ccWMQMqM.o: In function `minit::RankItems::RankItems(minit::SubDataset&, int, minit::RankItems const&, int, unsigned int)':
RankItems.c:(.text+0x1fa): multiple definition of `minit::RankItems::RankItems(minit::SubDataset&, int, minit::RankItems const&, int, unsigned int)'
minit:(.text+0x5990): first defined here
/tmp/ccDeL01h.o: In function `minit::MinitAlgo::MinitAlgo(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
MinitAlgo.c:(.text+0x0): multiple definition of `minit::MinitAlgo::MinitAlgo(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
minit:(.text+0x6eb0): first defined here
/tmp/ccDeL01h.o: In function `minit::MinitAlgo::~MinitAlgo()':
MinitAlgo.c:(.text+0x128): multiple definition of `minit::MinitAlgo::~MinitAlgo()'
minit:(.text+0x6dc0): first defined here
/tmp/ccDeL01h.o: In function `minit::MinitAlgo::search(int, int, bool)':
MinitAlgo.c:(.text+0x1ee): multiple definition of `minit::MinitAlgo::search(int, int, bool)'
minit:(.text+0x93f0): first defined here
/tmp/ccDeL01h.o: In function `minit::MinitAlgo::minitRecursive(minit::SubDataset&, minit::RankItems const&, int, int)':
MinitAlgo.c:(.text+0x6fc): multiple definition of `minit::MinitAlgo::minitRecursive(minit::SubDataset&, minit::RankItems const&, int, int)'
minit:(.text+0x9860): first defined here
/tmp/ccDeL01h.o: In function `minit::MinitAlgo::processMinII(int, unsigned int, unsigned int)':
MinitAlgo.c:(.text+0x678): multiple definition of `minit::MinitAlgo::processMinII(int, unsigned int, unsigned int)'
minit:(.text+0x6d70): first defined here
/tmp/ccDeL01h.o: In function `minit::MinitAlgo::requiredSupportTransactionsExist(unsigned int const&, minit::Itemset const&, unsigned int const&, minit::SubDataset const&, int)':
MinitAlgo.c:(.text+0x10f0): multiple definition of `minit::MinitAlgo::requiredSupportTransactionsExist(unsigned int const&, minit::Itemset const&, unsigned int const&, minit::SubDataset const&, int)'
minit:(.text+0x6fe0): first defined here
/tmp/ccDeL01h.o: In function `minit::MinitAlgo::MinitAlgo(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
MinitAlgo.c:(.text+0x0): multiple definition of `minit::MinitAlgo::MinitAlgo(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
minit:(.text+0x6eb0): first defined here
/tmp/ccDeL01h.o: In function `minit::MinitAlgo::~MinitAlgo()':
MinitAlgo.c:(.text+0x128): multiple definition of `minit::MinitAlgo::~MinitAlgo()'
minit:(.text+0x6dc0): first defined here
/usr/lib/gcc/x86_64-amazon-linux/4.6.3/crtend.o:(.dtors+0x0): multiple definition of `__DTOR_END__'
minit:(.dtors+0x8): first defined here
/usr/bin/ld: error in minit(.eh_frame); no .eh_frame_hdr table will be created.
collect2: ld returned 1 exit status
[ec2-user@ip-10-209-16-177 minit++]$ 
[ec2-user@ip-10-209-16-177 minit++]$ g++ -o -O0 minit minit.c MinitGlobal.h Item.c ItemsetQueue.c Transaction.c Error.h Dataset.c SubDataset.c RankItems.c MinitAlgo.c
minit: In function `_start':
(.text+0x2a8): multiple definition of `_start'
/usr/lib/gcc/x86_64-amazon-linux/4.6.3/../../../../lib64/crt1.o:(.text+0x0): first defined here
minit: In function `_fini':
(.fini+0x0): multiple definition of `_fini'
/usr/lib/gcc/x86_64-amazon-linux/4.6.3/../../../../lib64/crti.o:(.fini+0x0): first defined here
minit:(.rodata+0x0): multiple definition of `_IO_stdin_used'
/usr/lib/gcc/x86_64-amazon-linux/4.6.3/../../../../lib64/crt1.o:(.rodata.cst4+0x0): first defined here
minit: In function `__data_start':
(.data+0x0): multiple definition of `__data_start'
/usr/lib/gcc/x86_64-amazon-linux/4.6.3/../../../../lib64/crt1.o:(.data+0x0): first defined here
minit:(.rodata+0x8): multiple definition of `__dso_handle'
/usr/lib/gcc/x86_64-amazon-linux/4.6.3/crtbegin.o:(.rodata+0x0): first defined here
minit: In function `_init':
(.init+0x0): multiple definition of `_init'
/usr/lib/gcc/x86_64-amazon-linux/4.6.3/../../../../lib64/crti.o:(.init+0x0): first defined here
/tmp/cc0cvoT6.o: In function `main':
minit.c:(.text+0x4d2): multiple definition of `main'
minit:(.text+0x0): first defined here
/tmp/ccRfRvQv.o:(.bss+0x0): multiple definition of `minit::Itemset::count'
minit:(.bss+0x638): first defined here
/tmp/ccQhesuV.o: In function `minit::ItemsetQueue::ItemsetQueue()':
ItemsetQueue.c:(.text+0x0): multiple definition of `minit::ItemsetQueue::ItemsetQueue()'
minit:(.text+0x390): first defined here
/tmp/ccQhesuV.o: In function `minit::ItemsetQueue::enqueue(unsigned int const&, unsigned int)':
ItemsetQueue.c:(.text+0x7e): multiple definition of `minit::ItemsetQueue::enqueue(unsigned int const&, unsigned int)'
minit:(.text+0x430): first defined here
/tmp/ccQhesuV.o: In function `minit::ItemsetQueue::enqueue(minit::Itemset const&, unsigned int const&, unsigned int)':
ItemsetQueue.c:(.text+0xfe): multiple definition of `minit::ItemsetQueue::enqueue(minit::Itemset const&, unsigned int const&, unsigned int)'
minit:(.text+0x520): first defined here
/tmp/ccQhesuV.o: In function `minit::ItemsetQueue::dequeue()':
ItemsetQueue.c:(.text+0x186): multiple definition of `minit::ItemsetQueue::dequeue()'
minit:(.text+0x3b0): first defined here
/tmp/ccQhesuV.o: In function `minit::ItemsetQueue::print(std::basic_ostream<char, std::char_traits<char> >&) const':
ItemsetQueue.c:(.text+0x1f2): multiple definition of `minit::ItemsetQueue::print(std::basic_ostream<char, std::char_traits<char> >&) const'
minit:(.text+0x6d0): first defined here
/tmp/ccQhesuV.o: In function `minit::ItemsetQueue::printItemsets(std::basic_ostream<char, std::char_traits<char> >&) const':
ItemsetQueue.c:(.text+0x306): multiple definition of `minit::ItemsetQueue::printItemsets(std::basic_ostream<char, std::char_traits<char> >&) const'
minit:(.text+0xa60): first defined here
/tmp/ccQhesuV.o: In function `minit::ItemsetQueue::ItemsetQueue()':
ItemsetQueue.c:(.text+0x0): multiple definition of `minit::ItemsetQueue::ItemsetQueue()'
minit:(.text+0x390): first defined here
/tmp/cc6ZqTIl.o: In function `minit::Transaction::readTransaction(std::basic_istream<char, std::char_traits<char> >&)':
Transaction.c:(.text+0x0): multiple definition of `minit::Transaction::readTransaction(std::basic_istream<char, std::char_traits<char> >&)'
minit:(.text+0x16b0): first defined here
/tmp/cc6ZqTIl.o: In function `minit::Transaction::readValue(std::basic_istream<char, std::char_traits<char> >&)':
Transaction.c:(.text+0x14a): multiple definition of `minit::Transaction::readValue(std::basic_istream<char, std::char_traits<char> >&)'
minit:(.text+0x15b0): first defined here
/tmp/ccZandoO.o: In function `minit::Dataset::Dataset(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
Dataset.c:(.text+0x0): multiple definition of `minit::Dataset::Dataset(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
minit:(.text+0x29b0): first defined here
/tmp/ccZandoO.o: In function `minit::Dataset::readDataset(std::basic_istream<char, std::char_traits<char> >&)':
Dataset.c:(.text+0x644): multiple definition of `minit::Dataset::readDataset(std::basic_istream<char, std::char_traits<char> >&)'
minit:(.text+0x2350): first defined here
/tmp/ccZandoO.o: In function `minit::Dataset::~Dataset()':
Dataset.c:(.text+0x512): multiple definition of `minit::Dataset::~Dataset()'
minit:(.text+0x1af0): first defined here
/tmp/ccZandoO.o: In function `minit::Dataset::toString() const':
Dataset.c:(.text+0x7f0): multiple definition of `minit::Dataset::toString() const'
minit:(.text+0x1c00): first defined here
/tmp/ccZandoO.o: In function `minit::Dataset::printColumnInfo()':
Dataset.c:(.text+0x9d6): multiple definition of `minit::Dataset::printColumnInfo()'
minit:(.text+0x2200): first defined here
/tmp/ccZandoO.o: In function `minit::Dataset::Dataset(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
Dataset.c:(.text+0x0): multiple definition of `minit::Dataset::Dataset(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
minit:(.text+0x29b0): first defined here
/tmp/ccZandoO.o: In function `minit::Dataset::~Dataset()':
Dataset.c:(.text+0x512): multiple definition of `minit::Dataset::~Dataset()'
minit:(.text+0x1af0): first defined here
/tmp/cc3PBOXh.o: In function `minit::SubDataset::SubDataset(minit::Dataset const&)':
SubDataset.c:(.text+0x0): multiple definition of `minit::SubDataset::SubDataset(minit::Dataset const&)'
minit:(.text+0x3c20): first defined here
/tmp/cc3PBOXh.o:(.bss+0x0): multiple definition of `minit::SubDataset::count'
minit:(.bss+0x670): first defined here
/tmp/cc3PBOXh.o:(.bss+0x10): multiple definition of `minit::SubDataset::preComputeCallsPerMaxc'
minit:(.bss+0x650): first defined here
/tmp/cc3PBOXh.o: In function `minit::SubDataset::SubDataset(minit::SubDataset const&)':
SubDataset.c:(.text+0x11a): multiple definition of `minit::SubDataset::SubDataset(minit::SubDataset const&)'
minit:(.text+0x3360): first defined here
/tmp/cc3PBOXh.o: In function `minit::SubDataset::~SubDataset()':
SubDataset.c:(.text+0x1b8): multiple definition of `minit::SubDataset::~SubDataset()'
minit:(.text+0x33f0): first defined here
/tmp/cc3PBOXh.o: In function `minit::SubDataset::~SubDataset()':
SubDataset.c:(.text+0x1b8): multiple definition of `minit::SubDataset::~SubDataset()'
minit:(.text+0x33f0): first defined here
/tmp/cc3PBOXh.o: In function `minit::SubDataset::supportSet(unsigned int) const':
SubDataset.c:(.text+0x242): multiple definition of `minit::SubDataset::supportSet(unsigned int) const'
minit:(.text+0x33a0): first defined here
/tmp/cc3PBOXh.o: In function `minit::SubDataset::preComputeSupportSets(minit::RankItems const&, int, int, int)':
SubDataset.c:(.text+0x2ac): multiple definition of `minit::SubDataset::preComputeSupportSets(minit::RankItems const&, int, int, int)'
minit:(.text+0x40d0): first defined here
/tmp/cc3PBOXh.o: In function `minit::SubDataset::preComputeSupportSetsLeafNode(minit::RankItems const&, unsigned int, unsigned int)':
SubDataset.c:(.text+0x514): multiple definition of `minit::SubDataset::preComputeSupportSetsLeafNode(minit::RankItems const&, unsigned int, unsigned int)'
minit:(.text+0x3f30): first defined here
/tmp/cc3PBOXh.o: In function `minit::SubDataset::SubDataset(minit::SubDataset const&)':
SubDataset.c:(.text+0x11a): multiple definition of `minit::SubDataset::SubDataset(minit::SubDataset const&)'
minit:(.text+0x3360): first defined here
/tmp/cc3PBOXh.o: In function `minit::SubDataset::doneWithAnchorItem(unsigned int const&)':
SubDataset.c:(.text+0x6a0): multiple definition of `minit::SubDataset::doneWithAnchorItem(unsigned int const&)'
minit:(.text+0x37e0): first defined here
/tmp/cc3PBOXh.o: In function `minit::SubDataset::SubDataset(minit::Dataset const&)':
SubDataset.c:(.text+0x0): multiple definition of `minit::SubDataset::SubDataset(minit::Dataset const&)'
minit:(.text+0x3c20): first defined here
/tmp/ccWMQMqM.o: In function `minit::RankItems::RankItems(minit::Dataset const&)':
RankItems.c:(.text+0x0): multiple definition of `minit::RankItems::RankItems(minit::Dataset const&)'
minit:(.text+0x56c0): first defined here
/tmp/ccWMQMqM.o:(.bss+0x0): multiple definition of `minit::RankItems::count'
minit:(.bss+0x680): first defined here
/tmp/ccWMQMqM.o: In function `minit::RankItems::RankItems(minit::SubDataset&, int, minit::RankItems const&, int, unsigned int)':
RankItems.c:(.text+0x1fa): multiple definition of `minit::RankItems::RankItems(minit::SubDataset&, int, minit::RankItems const&, int, unsigned int)'
minit:(.text+0x5990): first defined here
/tmp/ccWMQMqM.o: In function `minit::RankItems::toString() const':
RankItems.c:(.text+0x4e0): multiple definition of `minit::RankItems::toString() const'
minit:(.text+0x5130): first defined here
/tmp/ccWMQMqM.o: In function `minit::RankItems::RankItems(minit::Dataset const&)':
RankItems.c:(.text+0x0): multiple definition of `minit::RankItems::RankItems(minit::Dataset const&)'
minit:(.text+0x56c0): first defined here
/tmp/ccWMQMqM.o: In function `minit::RankItems::RankItems(minit::SubDataset&, int, minit::RankItems const&, int, unsigned int)':
RankItems.c:(.text+0x1fa): multiple definition of `minit::RankItems::RankItems(minit::SubDataset&, int, minit::RankItems const&, int, unsigned int)'
minit:(.text+0x5990): first defined here
/tmp/ccDeL01h.o: In function `minit::MinitAlgo::MinitAlgo(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
MinitAlgo.c:(.text+0x0): multiple definition of `minit::MinitAlgo::MinitAlgo(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
minit:(.text+0x6eb0): first defined here
/tmp/ccDeL01h.o: In function `minit::MinitAlgo::~MinitAlgo()':
MinitAlgo.c:(.text+0x128): multiple definition of `minit::MinitAlgo::~MinitAlgo()'
minit:(.text+0x6dc0): first defined here
/tmp/ccDeL01h.o: In function `minit::MinitAlgo::search(int, int, bool)':
MinitAlgo.c:(.text+0x1ee): multiple definition of `minit::MinitAlgo::search(int, int, bool)'
minit:(.text+0x93f0): first defined here
/tmp/ccDeL01h.o: In function `minit::MinitAlgo::minitRecursive(minit::SubDataset&, minit::RankItems const&, int, int)':
MinitAlgo.c:(.text+0x6fc): multiple definition of `minit::MinitAlgo::minitRecursive(minit::SubDataset&, minit::RankItems const&, int, int)'
minit:(.text+0x9860): first defined here
/tmp/ccDeL01h.o: In function `minit::MinitAlgo::processMinII(int, unsigned int, unsigned int)':
MinitAlgo.c:(.text+0x678): multiple definition of `minit::MinitAlgo::processMinII(int, unsigned int, unsigned int)'
minit:(.text+0x6d70): first defined here
/tmp/ccDeL01h.o: In function `minit::MinitAlgo::requiredSupportTransactionsExist(unsigned int const&, minit::Itemset const&, unsigned int const&, minit::SubDataset const&, int)':
MinitAlgo.c:(.text+0x10f0): multiple definition of `minit::MinitAlgo::requiredSupportTransactionsExist(unsigned int const&, minit::Itemset const&, unsigned int const&, minit::SubDataset const&, int)'
minit:(.text+0x6fe0): first defined here
/tmp/ccDeL01h.o: In function `minit::MinitAlgo::MinitAlgo(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
MinitAlgo.c:(.text+0x0): multiple definition of `minit::MinitAlgo::MinitAlgo(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
minit:(.text+0x6eb0): first defined here
/tmp/ccDeL01h.o: In function `minit::MinitAlgo::~MinitAlgo()':
MinitAlgo.c:(.text+0x128): multiple definition of `minit::MinitAlgo::~MinitAlgo()'
minit:(.text+0x6dc0): first defined here
/usr/lib/gcc/x86_64-amazon-linux/4.6.3/crtend.o:(.dtors+0x0): multiple definition of `__DTOR_END__'
minit:(.dtors+0x8): first defined here
/usr/bin/ld: error in minit(.eh_frame); no .eh_frame_hdr table will be created.
collect2: ld returned 1 exit status
[ec2-user@ip-10-209-16-177 minit++]$ 

它崩溃了。所有错误都属于“多重定义”性质,您能否建议如何解决这个问题?

1 个答案:

答案 0 :(得分:2)

gcc / g++希望在-o之后直接输出文件的名称。你混淆了参数顺序:

而不是g++ -o -O0 minit ...尝试g++ -O0 -o minit ...

g++尝试将可执行文件minit和目标文件链接到一个程序集中,这就是您遇到这些错误的原因。