What library in OpenDDS contains "OpenDDS::DCPS::operator<<"? - data-distribution-service

I'm having an issue linking my shared library against an OpenDDS (v3.9) static library because I am unable to find where this method signature is located.
Here's the error.
[exec] libs/mylib/ABTypeSupportImpl.cpp:74: error: undefined reference to 'OpenDDS::DCPS::operator<<(OpenDDS::DCPS::Serializer&, short)'
[exec] collect2: error: ld returned 1 exit status
[exec] make: *** [/tmp/mybuild/lib_ab/obj/local/armeabi-v7a/lib_ab.so] Error 1
ABTypeSupportImpl.cpp is auto generated from compiling the IDL. More of the same errors follow. Because of the namespace (OpenDDS::DCPS), I would think this would be found within the library libOpenDDS_Dcps.a, but using nm on this lib and then grep'ing for "operator" or "<<", produces no results. Could it be that name mangling is a bit stranger for overloaded operators? I ran this on every library file within $DDS_ROOT/lib, but found nothing.
And if I recompile the IDL and remove member fields of structs with datatypes such as short or long, then there are no errors and everything links fine.
Anyone know what library this method signature might be located?

These operators are declared in 'dds/DCPS/Serializer.h' but implemented inline in Serializer.inl. Probably you compile OpenDDS with inlining enabled (its default) but when you compile your application you compile with inlining disabled.

Related

"unresolved import" with a circular dependency between modules

I have two files :
json.rs in which I call Builder, a struct defined in builder.rs
builder.rs in which I call Json, a struct defined in json.rs
As you can see there is a circular dependency between these two modules. It seems like sometimes Rust supports circular dependencies, but for this case, the compiler throws errors:
src/json/mod.rs:1:25: 1:31 error: unresolved import (maybe you meant `ToJson::*`?)
src/json/mod.rs:1 pub use self::to_json::{ToJson};
^~~~~~
src/json/builder.rs:2:18: 2:22 error: unresolved import (maybe you meant `Json::*`?)
src/json/builder.rs:2 use json::json::{Json, JsonEvent, Array, Object}; //commenting this line solve the dependency error
[...]
The code is here in the branch json_mod. I tried to reproduce the problem in fewer lines of code, but the circular dependencies I created compiled correctly.
After the debugging, something like 400 errors are left — this is normal as I am in the process of a huge code refactoring (splitting one file of ~= 4000 line file into many files) and I still have a lot of work to do before making it work.
Edit: Glorious news, the bug mentioned below is fixed! It's fixed in Rust 1.4 or later.
Glob imports (use foo::*) have a known bug where they are incompatible with cyclic imports. I would try removing the glob imports in both affected modules.

Mono compilation error CS0121: The call is ambiguous between the following methods or properties

I get the following compilation error in Monodevelop:
Error CS0121: The call is ambiguous between the following methods or properties:
'System.Linq.Enumerable.ToArray<AudioBitrateCalculationStream>(this System.Collections.Generic.IEnumerable<AudioBitrateCalculationStream>)' and
'System.Linq.Enumerable.ToArray<AudioBitrateCalculationStream>(this System.Collections.Generic.IEnumerable<AudioBitrateCalculationStream>)' (CS0121)
Both definitions are exactly the same. I cannot understand what the issue is. Internet search does not help.

Non-static data member error with clang but not g++

Summary:
I have a code snippet that compiles fine with g++ but not with clang.
Details:
I have a project that compiles fine with g++ but when compiling with clang I get an error about error: use of non-static data member. I tried to create a small test case that would demonstrate the problem, but for the small test case g++ gave the same error as clang.
I've posted a 236 line file to pastebin that demonstrates the problem:
http://pastebin.com/DGnfxmYe
When compiled with g++ 4.6.3 this works fine. But when compiled with clang 3.2 I get the following error messages:
myhashmap.hpp:169:29: error: use of non-static data member 'num_bins' of 'MyHashMap' from nested type 'iterator'
for (_index++; (_index < num_bins) && (bins[_index] == NULL); _index++)
^~~~~~~~
myhashmap.hpp:169:43: error: use of non-static data member 'bins' of 'MyHashMap' from nested type 'iterator'
for (_index++; (_index < num_bins) && (bins[_index] == NULL); _index++)
^~~~
myhashmap.hpp:171:17: error: use of non-static data member 'num_bins' of 'MyHashMap' from nested type 'iterator'
if (_index < num_bins) {
^~~~~~~~
myhashmap.hpp:172:17: error: use of non-static data member 'bins' of 'MyHashMap' from nested type 'iterator'
_theNode = bins[_index];
^~~~
Looking at the code, it makes sense to me why clang is giving these error messages. What I don't understand is why g++ compiled the code correctly in the first place. I did not write this code but I would like to get it to compile cleanly with clang. So I'm trying to understand exactly what it is doing. And I would be interested in understanding why it compiles with g++ but not with clang. Does g++ interpret the c++ standard differently, or is there some g++ extension that the code is taking advantage of?
It fails with GCC 4.8 (prerelease) so I assume it's a bug that's been fixed. I can't find a corresponding bug report though.
To fix the code I think you'll need add an int _num_bins member to the iterator and pass the cotnainer's num_bins to the iterator constructor in begin() and end(), so it's stored in each iterator object.
(Additionally, don't write (void) for a function taking no arguments, that's an abomination. In C++ a function taking no arguments is written ())

undefined symbols error in c++, while the header file exists

Sorry if I'm asking a dumb question, but I've been stuck on this one for quite some time now. So, I'm trying to compile a program using cmake, that calls functions from a videosource.cpp file, with its corresponding videosource.h file.
The compiler finds the file, but when linking makes this error:
Undefined symbols:
"VideoSourceFactory::construct()", referenced from:
_main in main.cpp.o
However, in the videosource.h, the function is defined, as:
class VideoSourceFactory {
public:
VideoSourceFactory();
...}
Does anyone have an idea what can be causing this kind of errors to happen??
Thanks in advance!
videosource.cpp file must be added to the files list, together with main.cpp.

Unresolved external symbol error

I am getting the following error in my VC++ COM project. What is the problem in linking the lib files here?
Error 4 error LNK2019: unresolved external symbol _BVUOpen#8 referenced in function "unsigned int __stdcall AFunc(void *)" (?AFunc##YGIPAX#Z) CBillAcceptor.obj BillAcceptorCOM
Here are the explanation of the LNK2019 error : MSDN.
Look for a problem of definition about BVUOPen symbol ! The problem si inside the method AFunc Maybe, you haven't declare it correctly or haven't link the library or haven't export the symbol...
Probably, you need to link against some external library that contains the object code for the BVUOpen function. The name of that library is not obvious from your error message, but it should be possible to work out from the documentation you are coding from.