j0r1 / JRTPLIB

RTP Library
MIT License
584 stars 219 forks source link

Avoid `using namespace std` to allow c++14 compilation #25

Closed MatanShahar closed 5 years ago

MatanShahar commented 5 years ago

The jrtp library won't compile with a C++ 14 standard library due to the addition of std::bind which conflicts with jrtp's bind. This only happens for the src/rtpudpv4transmitter.cpp file which imports the std namespace into the global namespace for that compilation unit. This PR removes the using namespace std; statement and changes any reference to std names to be explicit (i.e. std::vector).

j0r1 commented 5 years ago

That's odd, if I enable C++14 support on my gcc 5.3, I don't have any problems. What compiler/platform are you using?

MatanShahar commented 5 years ago

I encountered this with the current version of Clang that ships with Xcode:

Apple LLVM version 10.0.0 (clang-1000.10.44.2) Target: x86_64-apple-darwin18.0.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin

It does not happen on GCC it looks like - does not reproduce on 8.2.

j0r1 commented 5 years ago

Ok, so with the apple clang it's indeed a problem, not just when activating c++14, also with c++11. With clang from ubuntu 18.04 there's no problem btw, neither with the intel compiler.

What's the reason you need to compile jrtplib itself with c++14 support ?

j0r1 commented 5 years ago

I've merged your pull request - apparently there were other scenarios where this was a problem for some reason. Thanks!