
h:14:0,įrom eipIoc_ registerRecordD eviceDriver. In file included from /C2/ioc- modules/ build/BASE/ 7.0.2-C2- 3+PH-001/ include/ registr圜ommon. I suspect that this is less reliable in terms of spotting bugs than viewing the header and implementation files side by side./usr/bin/g++ -D_GNU_SOURCE -D_DEFAULT_SOURCE -D_X86_64_ -DUNIX -Dlinux -O3 -g -Wall -DUSE_TYPED_RSET -DUSE_TYPED_DSET -DUSE_TYPED_DRVET -mtune=generic -m64 -I. If the two files are in different tabs, you’re relying on your memory to reliably take a snapshot of the definition/declaration as you switch between files. I think viewing the function declaration and definition at the same time helps. It’s interesting that obvious bugs like this can trip you up. However in this case, the return type differs - this is not part of function overloading, so the declarations differ and the compiler can’t make sense of what you need. This is not necessarily a problem - as function overloading involves re-declaring a function with different parameter types. The first error uses the word “new” because it can see the declaration has already been made (in the header file). The declaration is incompatible with the declaration in the header file because the return type differs. In this case, the compiler has read the function declaration/definition in the file IntArray.cpp and spotted a problem: “error: ambiguating new declaration…”. It may not seem like the most obvious error message, but the caret in the second error really pinpoints the issue. If you’re relatively new to C++ (or maybe just tired) you might miss this. void swap ( IntArray & a, IntArray & b )

Friend IntArray & mySwap ( IntArray & a, IntArray & b ) // IntArray.cpp
