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

LNK2005 already defined #4

Closed
vsranjitroshan opened this issue Jun 27, 2023 · 21 comments
Closed

LNK2005 already defined #4

vsranjitroshan opened this issue Jun 27, 2023 · 21 comments

Comments

@vsranjitroshan
Copy link

vsranjitroshan commented Jun 27, 2023

First off thanks for this library. I added the udgcd.hpp header file to my header file and added boost path in project settings.
I just wanted to see if the compilation works, so I started to build it and ran into a couple of error.

First, in like 239 and 240 I got this error. How can I resolve this?

const auto begin() const -> decltype(_data.begin()) { return _data.begin(); }
const auto end() const -> decltype(_data.end()) { return _data.end(); }

The error says,

Severity Code Description Project File Line Suppression State
Error C3551 if a trailing return type is used then the leading return type shall be the single type-specifier 'auto' (not 'const auto') ... 239

Thankyou for your time.

@skramm
Copy link
Owner

skramm commented Jun 27, 2023

Thanks for your feedback, always appreciated.
It's been a while that I didn't check this project, I'l try to add some CI in the future.

Could you give some details: OS, compiler?
This has been only tested with gcc at present, and on other projects, I noticed that some compilers may generate errors/warnings when gcc is fine.

@skramm
Copy link
Owner

skramm commented Jun 27, 2023

Just pushed a bug fix about these two lines, could you pull and check out? Please let me know, maybe other similar issues.

@vsranjitroshan
Copy link
Author

vsranjitroshan commented Jun 27, 2023

So I pulled and tried to build it in my project again, this time I got a couple of linker errors.

Severity Code Description Project File Line Suppression State Error LNK2005 "int __cdecl udgcd::priv::dotProduct(class boost::dynamic_bitset<unsigned long,class std::allocator<unsigned long> > const &,class boost::dynamic_bitset<unsigned long,class std::allocator<unsigned long> > const &)" (?dotProduct@priv@udgcd@@YAHAEBV?$dynamic_bitset@KV?$allocator@K@std@@@boost@@0@Z) already defined in VSPluginMuJoCoExtension.obj VSPluginMuJoCo Z:\VEROSIM\006\Intermediate\Win64VC14_WIDGETS\VSPluginMuJoCo\moc_VSPluginMuJoCoExtension.obj 1

Severity Code Description Project File Line Suppression State Error LNK2005 "struct udgcd::priv::BinaryMatrix __cdecl udgcd::priv::deprec::reduceMatrix(struct udgcd::priv::BinaryMatrix const &,class std::vector<unsigned __int64,class std::allocator<unsigned __int64> > const &)" (?reduceMatrix@deprec@priv@udgcd@@YA?AUBinaryMatrix@23@AEBU423@AEBV?$vector@_KV?$allocator@_K@std@@@std@@@Z) already defined in VSPluginMuJoCoExtension.obj VSPluginMuJoCo Z:\VEROSIM\006\Intermediate\Win64VC14_WIDGETS\VSPluginMuJoCo\moc_VSPluginMuJoCoExtension.obj 1

Severity Code Description Project File Line Suppression State Error LNK1169 one or more multiply defined symbols found VSPluginMuJoCo Z:\VEROSIM\006\Target\Bin\Win64VC14_WIDGETS\Release\VSPluginMuJoCo.dll 1

@skramm
Copy link
Owner

skramm commented Jun 27, 2023

What compiler / OS?

@vsranjitroshan
Copy link
Author

vsranjitroshan commented Jun 27, 2023

Windows, MSVC

@skramm
Copy link
Owner

skramm commented Jun 27, 2023

Oops, I think I know what this is about, some missing inline. Working on it, I'll let you know.

@vsranjitroshan
Copy link
Author

thankyou so much

@skramm
Copy link
Owner

skramm commented Jun 27, 2023

Just pushed bugfix with some inlining added. I hope I didn't miss any (Linux here, and only GCC).
Could you check and let me know?

@vsranjitroshan
Copy link
Author

Yess checking now

@vsranjitroshan
Copy link
Author

So, the other errors are gone except this

Severity Code Description Project File Line Suppression State Error LNK2005 "class std::vector<unsigned __int64,class std::allocator<unsigned __int64> > __cdecl udgcd::priv::deprec::buildFullBinaryIndex(unsigned __int64)" (?buildFullBinaryIndex@deprec@priv@udgcd@@YA?AV?$vector@_KV?$allocator@_K@std@@@std@@_K@Z) already defined in VSPluginMuJoCoExtension.obj VSPluginMuJoCo Z:\VEROSIM\006\Intermediate\Win64VC14_WIDGETS\VSPluginMuJoCo\moc_VSPluginMuJoCoExtension.obj 1

@skramm
Copy link
Owner

skramm commented Jun 27, 2023

This is strange, because that function is tagged as deprecated (see namespace), thus shouldn't be called. I'll investigate and let you know.

@vsranjitroshan
Copy link
Author

Ohh ok, thankyou

@skramm
Copy link
Owner

skramm commented Jun 28, 2023

Currently adding a CI process through GH actions to avoid back and forth attempts (you trying, me fixing ;-)
see https://github.com/skramm/udgcd/actions
Pretty easy for Linux, and succeeds for both GCC and clang, but I am struggling with Windows because there is a dependency on Boost, and I'm not sure how I can import that in GH actions.
In the meantime, I did a minor fix, could you please pull and try again, thanks!

@vsranjitroshan
Copy link
Author

Yess, awesome, I wil try that now

@vsranjitroshan
Copy link
Author

The same error is there, with another saying one or more multiply defined symbols loaded

@skramm
Copy link
Owner

skramm commented Jun 28, 2023

The same function?you are sure? I don't get it. I'll check that.

@vsranjitroshan
Copy link
Author

Severity Code Description Project File Line Suppression State Error LNK2005 "class std::vector<unsigned __int64,class std::allocator<unsigned __int64> > __cdecl udgcd::priv::deprec::buildFullBinaryIndex(unsigned __int64)" (?buildFullBinaryIndex@deprec@priv@udgcd@@YA?AV?$vector@_KV?$allocator@_K@std@@@std@@_K@Z) already defined in VSPluginMuJoCoExtension.obj VSPluginMuJoCo Z:\VEROSIM\006\Intermediate\Win64VC14_WIDGETS\VSPluginMuJoCo\moc_VSPluginMuJoCoExtension.obj 1

ya seems like the same, I don;t know why, is it a problem with boost version, I am using 1.80

@skramm
Copy link
Owner

skramm commented Jun 28, 2023

Yep, true, forgot that one.
Indeed, non-templated functions need to be inlined...
I hope I didn't miss anything, sorry for inconvieniency.
Please pull and check.

@vsranjitroshan
Copy link
Author

great, it compiles, now thanks a lot, I just tried adding the header file first, now will build the graph and check for cycles. Thank you so much for all your efforts, you are such an amazing developer.

@skramm
Copy link
Owner

skramm commented Jun 28, 2023

You're welcome, but be warned that I stopped working on that project quite a while ago. Sadly, I left it in a quite messy state (although it does work with the samples provided). I would have loved to make it more robust.
Don't expect reasonable performance for large graphs, the memory footprint will get pretty large (recursive algorithm). And I'm afraid I wont be able to provide much support! (except maybe for "technical" stuff).

@vsranjitroshan
Copy link
Author

Yes, I can understand, it is really amazing what you have achieved here, I started studying the boost library to setup what you had did, and it would have taken me atleast 3 weeks to get some basic code running, this saved me a lot of time, and I also plan to use it for graphs with nodes in the range of 50 to 75, I hope it is small enough for a recursive footprint. I will post how the algorithm worked for me once I implement it fully.

have a nice day!

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