(.bss+0x0): multiple definition of Proxies
<p>I have this code for automating a robot. It uses some proxy classes from Player - an open-source software for programming robots. I compiled the two cpp files using these commands:</p>

<pre>
g++ -c -Wall  navigation.cpp `pkg-config --cflags playerc++` `pkg-config --libs playerc++`
and
g++ -c -Wall  autonavigation.cpp `pkg-config --cflags playerc++` `pkg-config --libs playerc++`
I then linked the object files (which is where the problem arises):
g++ -o autonavigate  navigation.o autonavigation.o `pkg-config --cflags playerc++` `pkg-config --libs playerc++`.
</pre>

<p>The code is here:</p>

<pre>
erratic@erratic-desktop:~/Desktop/autonav$ g++ -o autonavigate navigation.o 
autonavigation.o `pkg-config --cflags playerc++` `pkg-config --libs playerc++`

autonavigation.o:(.bss+0x0): multiple definition of `gHostname'

navigation.o:(.bss+0x0): first defined here

autonavigation.o:(.data+0x0): multiple definition of `gPort'

navigation.o:(.data+0x0): first defined here

autonavigation.o:(.bss+0x4): multiple definition of `gIndex'

navigation.o:(.bss+0x4): first defined here

autonavigation.o:(.bss+0x8): multiple definition of `gDebug'

navigation.o:(.bss+0x8): first defined here

autonavigation.o:(.data+0x4): multiple definition of `gFrequency'

navigation.o:(.data+0x4): first defined here

autonavigation.o:(.data+0x8): multiple definition of `gDataMode'

navigation.o:(.data+0x8): first defined here

autonavigation.o:(.bss+0xc): multiple definition of `gUseLaser'

navigation.o:(.bss+0xc): first defined here

autonavigation.o: In function `parse_args(int, char**)':

autonavigation.cpp:(.text+0x0): multiple definition of `parse_args(int, char**)'

navigation.o:navigation.cpp:(.text+0x0): first defined here

autonavigation.o: In function `print_usage(int, char**)':

autonavigation.cpp:(.text+0x101): multiple definition of `print_usage(int, char**)'

navigation.o:navigation.cpp:(.text+0x101): first defined here

collect2: ld returned 1 exit status
</pre>

<p>Source code from comment:</p>

<pre><code>//navigation.h
#include &lt;libplayerc++/playerc++.h&gt;
#include &lt;stdio.h&gt;
#include &lt;time.h&gt;
#include "args.h"
#define PI 3.14159

using namespace std;
using namespace PlayerCc;

class navigation
{
public:
    navigation();
    void autoNavigate(PlayerClient &amp;, LaserProxy &amp;, Position2dProxy &amp;, PtzProxy &amp;, IrProxy &amp;, SonarProxy &amp;);

private:
    void wallFollow(LaserProxy &amp;, Position2dProxy &amp;);
    void obstacleAvoid(IrProxy &amp;, SonarProxy &amp;, PlayerClient &amp;, Position2dProxy &amp;);
};
</code></pre>

<p>Source for <code>autonavigation.cpp</code>:</p>

<pre><code>#include "navigation.h"

int main(int argc, char *argv[])
{
    PlayerClient robot("localhost");
    LaserProxy lp(&amp;robot,0);
    Position2dProxy pp(&amp;robot,0);
    PtzProxy ptp (&amp;robot,0);
    IrProxy ir(&amp;robot,0);
    SonarProxy sp(&amp;robot, gIndex);

    navigation nav;
    nav.autoNavigate(robot, lp, pp, ptp, ir, sp);
}
</code></pre>
