- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
If I create a file, a.cpp:
#include "daal.h" void f() { return; }
and another file, b.cpp:
#include "daal.h" void g() { return; }
then when I attempt to compile and link them with:
g++ a.cpp -I/opt/intel/compilers_and_libraries_2016.0.069/linux/daal/include -c -fPIC g++ b.cpp -I/opt/intel/compilers_and_libraries_2016.0.069/linux/daal/include -c -fPIC g++ -shared -o ab.so a.o b.o
then the following error is produced:
b.o: In function `void daal::data_management::DataSource::allocateNumericTableImpl<daal::data_management::AOSNumericTable>(daal::data_management::AOSNumericTable**)': b.cpp:(.text+0x0): multiple definition of `void daal::data_management::DataSource::allocateNumericTableImpl<daal::data_management::AOSNumericTable>(daal::data_management::AOSNumericTable**)' a.o:a.cpp:(.text+0x0): first defined here b.o: In function `void daal::data_management::DataSource::allocateNumericTableImpl<daal::data_management::SOANumericTable>(daal::data_management::SOANumericTable**)': b.cpp:(.text+0xa0): multiple definition of `void daal::data_management::DataSource::allocateNumericTableImpl<daal::data_management::SOANumericTable>(daal::data_management::SOANumericTable**)' a.o:a.cpp:(.text+0xa0): first defined here collect2: error: ld returned 1 exit status
Should I expect to be able to include daal.h in more than one source file? If so, is there a way around this error?
For reference, I am using this G++ version:
$ g++ --version g++ (Debian 4.9.2-10) 4.9.2
Many thanks,
Graham.
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As a workaround, declaring those two functions in include/data_management/connectors/data_source.h inline suppresses the issue:
template<> inline void DataSource::allocateNumericTableImpl(AOSNumericTable **nt) { size_t nFeatures = _dict->getNumberOfFeatures(); size_t structureSize = getStructureSize(); *nt = new AOSNumericTable(structureSize, nFeatures, 0); setNumericTableDictionary(*nt); } template<> inline void DataSource::allocateNumericTableImpl(SOANumericTable **nt) { *nt = 0; }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, Graham!
We fixed that in internal code base.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Minor cleanup required in soa_numeric_table.h on line 291 in allocateDataMemory().
Has "return;" two lines in a row.
Regards,
ACS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you, Alvin, for the catch! We will remove it. Andrey

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page