c++ - namespaces and -Error: ambiguous reference to symbol
- "Tom Lowe" <talowe tmynetplus.com> Apr 16 2002
- "Walter" <walter digitalmars.com> Apr 16 2002
- "Tom Lowe" <talowe tmynetplus.com> Apr 17 2002
Similar to what STLport does to pull global functions into std::
//test.cpp - test namespace
//global function
void testfunc(void){}
//pull into namespace
namespace myname{
using ::testfunc;
};
//use in namespace
namespace myname{
void func(void){
testfunc(); // Error: ambiguous reference to symbol
}
};
int main(void){
myname::func();
return 1;
};
output:
sc test.cpp
testfunc(); //Error: ambiguous reference to symbol
^
test.cpp(13) : Error: ambiguous reference to symbol
Had: testfunc()
and: testfunc()
--- errorlevel 1
Exit code: 1
Borland compiles cleanly.
bcc32 test.cpp
test.cpp:
Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
Exit code: 0
Apr 16 2002
DMC doesn't do the so-called "Koenig lookup" on namespaces. It will, but until then, probably the easiest thing is to use the STL included with DMC. "Tom Lowe" <talowe tmynetplus.com> wrote in message news:a9inco$1acd$2 digitaldaemon.com...Similar to what STLport does to pull global functions into std:: //test.cpp - test namespace //global function void testfunc(void){} //pull into namespace namespace myname{ using ::testfunc; }; //use in namespace namespace myname{ void func(void){ testfunc(); // Error: ambiguous reference to symbol } }; int main(void){ myname::func(); return 1; }; output:sc test.cpp
testfunc(); //Error: ambiguous reference to symbol ^ test.cpp(13) : Error: ambiguous reference to symbol Had: testfunc() and: testfunc() --- errorlevel 1Exit code: 1
Borland compiles cleanly.bcc32 test.cpp
test.cpp: Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 BorlandExit code: 0
Apr 16 2002
"Walter" <walter digitalmars.com> wrote in message news:a9j2vh$2h7f$1 digitaldaemon.com...DMC doesn't do the so-called "Koenig lookup" on namespaces. It will, but until then, probably the easiest thing is to use the STL included with
Was hoping I could use stlport to pull standard functions into std::, just have to wait. Thanks for the reply Tom Lowe talowe mynetplus.com
Apr 17 2002








"Tom Lowe" <talowe tmynetplus.com>