Thread: Multiple Definition

  1. #1
    Registered User
    Join Date
    Aug 2006

    Unhappy Multiple Definition

    Hi, I'm kind of not doing so hot at this whole programming thing. Could someone tell me what I'm doing wrong here?
    #include <iostream>
    #include "pr.cpp"
    using namespace std;
    int main()
    	return 0;
    #include "pr.h"
    int p()
        return 0;
    #ifndef _PR_H
    #define _PR_H
    int p();
    /home/workspace/programming/testing/pr.cpp:2: multiple definition of `p()'
    obj/Debug/pointer.o:/home/workspace/programming/testing/pr.cpp:2: first defined here
    :: === Build finished: 2 errors, 0 warnings ===

    I would appreciate it.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    > #include "pr.cpp"
    This should be
    #include "pr.h"
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Errors including <windows.h>
    By jw232 in forum Windows Programming
    Replies: 4
    Last Post: 07-29-2008, 01:29 PM
  2. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  3. Phantom redefinition
    By CodeMonkey in forum C++ Programming
    Replies: 6
    Last Post: 06-12-2005, 05:42 PM
  4. Warnings, warnings, warnings?
    By spentdome in forum C Programming
    Replies: 25
    Last Post: 05-27-2002, 06:49 PM
  5. gcc problem
    By bjdea1 in forum Linux Programming
    Replies: 13
    Last Post: 04-29-2002, 06:51 PM