Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

basic_demo.cpp:13:12: error: 'template<class> class vdk::signal' conflicts with a previous declaration #5

Open
anb0s opened this issue Dec 2, 2019 · 2 comments

Comments

@anb0s
Copy link

anb0s commented Dec 2, 2019

I'm facing compile errors with MInGW GCC 9.2 at Windows in basic_demo.cpp, cross_thread_calls.cpp and cross_thread_calls.cpp, because using vdk::signal conflicts then with x86_64-w64-mingw32/include/signal.h:60:24: note: previous declaration 'void (* signal(int, __p_sig_fn_t))(int)'

---------- ERRORS occurred while compiling file D:\git\s7p\work3\s7p.base\vdk\signals-master\demo\basic_demo.cpp
D:/git/s7p/work3/s7p.base/vdk/signals-master/demo/basic_demo.cpp:13:12: error: 'template<class> class vdk::signal' conflicts with a previous declaration
   13 | using vdk::signal;
      |            ^~~~~~
In file included from D:\git\s7p\work3\s7p.tools/win64_gcc_mingw64_9.2.0/x86_64-w64-mingw32/include/pthread.h:68,
                 from D:\git\s7p\work3\s7p.tools/win64_gcc_mingw64_9.2.0/include/c++/9.2.0/x86_64-w64-mingw32/bits/gthr-default.h:35,
                 from D:\git\s7p\work3\s7p.tools/win64_gcc_mingw64_9.2.0/include/c++/9.2.0/x86_64-w64-mingw32/bits/gthr.h:148,
                 from D:\git\s7p\work3\s7p.tools/win64_gcc_mingw64_9.2.0/include/c++/9.2.0/ext/atomicity.h:35,
                 from D:\git\s7p\work3\s7p.tools/win64_gcc_mingw64_9.2.0/include/c++/9.2.0/bits/ios_base.h:39,
                 from D:\git\s7p\work3\s7p.tools/win64_gcc_mingw64_9.2.0/include/c++/9.2.0/ios:42,
                 from D:\git\s7p\work3\s7p.tools/win64_gcc_mingw64_9.2.0/include/c++/9.2.0/ostream:38,
                 from D:\git\s7p\work3\s7p.tools/win64_gcc_mingw64_9.2.0/include/c++/9.2.0/iostream:39,
                 from D:/git/s7p/work3/s7p.base/vdk/signals-master/demo/demo.h:10,
                 from D:/git/s7p/work3/s7p.base/vdk/signals-master/demo/basic_demo.cpp:7:
D:\git\s7p\work3\s7p.tools/win64_gcc_mingw64_9.2.0/x86_64-w64-mingw32/include/signal.h:60:24: note: previous declaration 'void (* signal(int, __p_sig_fn_t))(int)'
   60 |   __p_sig_fn_t __cdecl signal(int _SigNum,__p_sig_fn_t _Func);
      |                        ^~~~~~
D:/git/s7p/work3/s7p.base/vdk/signals-master/demo/basic_demo.cpp: In function 'void signals_basic_demo()':
D:/git/s7p/work3/s7p.base/vdk/signals-master/demo/basic_demo.cpp:55:12: error: expected primary-expression before 'void'
   55 |     signal<void(int)> sig;
      |            ^~~~
D:/git/s7p/work3/s7p.base/vdk/signals-master/demo/basic_demo.cpp:58:5: error: 'sig' was not declared in this scope
   58 |     sig.connect(function);
      |     ^~~

After removing using vdk::signal and adding vdk:: to signal<void(const string &)> sig; it works then.

@vdksoft
Copy link
Owner

vdksoft commented Dec 3, 2019

Hi, thanks for pointing that out. In fact, this error is weird: signal mentioned in the error message is supposed to be in std namespace. I don't see how they may conflict. Anyway, I will just remove using declarations in demo files to fix the problem.

anb0s added a commit to anb0s/signals that referenced this issue Dec 3, 2019
basic_demo.cpp:13:12: error: 'template<class> class vdk::signal'
conflicts with a previous declaration vdksoft#5

vdksoft#5
@anb0s anb0s mentioned this issue Dec 3, 2019
@anb0s
Copy link
Author

anb0s commented Dec 3, 2019

Hi, thanks for pointing that out. In fact, this error is weird: signal mentioned in the error message is supposed to be in std namespace. I don't see how they may conflict. Anyway, I will just remove using declarations in demo files to fix the problem.

It looks like it comes from demo.h:10 --> iostream:39 --> ... --> pthread.h:68 --> signal.h:60, so here we have the declaration of void (* signal(int, __p_sig_fn_t))(int) without any std namespace etc., because it's C / POSIX and not C++.

I've also no idea how to avoid it and created an PR as you also described.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants