C++ programming problem.

Discussion in 'Mac Programming' started by plamen86, Oct 26, 2008.

  1. plamen86 macrumors newbie

    Oct 26, 2008
    Hi guys, I've just got a new version of XCode, and for some reason all of my C++ programs have stopped working!

    I'm only using the basic command utility. I transferred all of the files from my old computer to my new computer. Whilst the programs work fine on the old computer, on mthe new computer I keep getting the following error message:

    Linking <filepath> (1error)

    duplicate symbol _E in <path>
    Command /Developer/usr/bin/g++4.0 failed with exit code 1

    I really have no idea what's going on here!!

    Can anyone offer any help?

    Many thanks,
  2. ryanknu macrumors newbie

    Sep 12, 2008
    If you both

    #include "file.cpp"

    AND have it compiled into your target, your code will compile twice. Either you need to create a header file for your cpp file and only include the header,

    #include "file.h"

    OR you can remove the files from your target, and just include them as cpp files, by right clicking on the cpp files and then, under the targets tab, uncheck them (or just uncheck the box in the project window). Then your code will only compile once, and you won't get duplicate symbols.

    Sorry if this isn't your problem, it's just the issue I had and how I fixed it, and you were a bit vague.

Share This Page