Search Results

Search found 1 results on 1 pages for 'billyjean'.

Page 1/1 | 1 

  • linker error in simple program: multiple definition of function

    - by BillyJean
    My function test is added to two different .cpp-files and the functions are private to their respective files as shown below test1.cpp #include <iostream> using namespace std; void test() { cout << "test" << endl; } test2.cpp #include <iostream> using namespace std; void test() { cout << "test" << endl; } main.cpp #include <iostream> using namespace std; int main() { return 0; } During linking I get the error multiple definition of test() - but how is that possible, considering that the two files have their own private scope!? I could understand it if I included the function prototype in each .cpp-files' corresponding header, but there is no such thing in this example.

    Read the article

1