The title of the question does not reveal too much about my problem but I tried to explain the problem in a single phrase. Here is the problem, I have a similar code structure in an application compiled with MinGW in Windows and GCC in Linux. Visual Studio doesn't present any problem. The structure is as follows:
#include <iostream>
namespace idb
{
class Wrapper
{
public:
template<typename S>
void boo(S& s)
{
bind(s);
}
};
}
namespace idb // <- if this namespace changes, code explodes
{
struct Fulalas
{
int x;
};
}
namespace idb
{
void bind(idb::Fulalas f)
{
std::cout << f.x << std::endl;
}
}
namespace app
{
class Foo
{
public:
void func()
{
idb::Fulalas f;
f.x = 5;
w.boo(f);
}
private:
idb::Wrapper w;
};
}
int main()
{
app::Foo f;
f.func();
return 0;
}
The question is why in GCC/MinGW changing idb::Fulalas
to aaa::Fulalas
(or any name desired) generates the following error:
..\namespace\main.cpp: In instantiation of 'void idb::Wrapper::boo(S&) [with S = aaa::Fulalas]':
..\namespace\main.cpp:41:11: required from here
..\namespace\main.cpp:11:10: error: 'bind' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
bind(s);
^
..\namespace\main.cpp:26:7: note: 'void idb::bind(aaa::Fulalas)' declared here, later in the translation unit
void bind(aaa::Fulalas f)