NikulovE / cld3.net

Compact language detector v3 by Google for .Net
Apache License 2.0
7 stars 4 forks source link

Cannot compile CLD3.NET project #1

Closed markusmobius closed 6 months ago

markusmobius commented 3 years ago

I can compile the CLD3 project fine but I have trouble with the cld3.net wrapper project. I keep getting this error:

Error LNK2001 unresolved external symbol "private: static struct chrome_lang_id::ComponentRegistry<class chrome_lang_id::FeatureFunction __cdecl(void)> chrome_lang_id::RegisterableClass<class chrome_lang_id::FeatureFunction >::registry" (?registry@?$RegisterableClass@V?$FeatureFunction@VSentence@chrome_lang_id@@$$V@chrome_lang_id@@@chrome_lang_id@@0PAU?$ComponentRegistry@$$A6APAV?$FeatureFunction@VSentence@chrome_lang_id@@$$V@chrome_lang_id@@XZ@2@A) CLD3.Net 1 C:\Users\mobius\source\repos\cld3.net\CLD3.Net\CLD3.lib(nnet_language_identifier.obj)

NikulovE commented 3 years ago

I can share with you dll if require. Project based on Google's Cld3 and I can't help you with this error. I was difficult to compile for me too

markusmobius commented 3 years ago

That would be great! However, I am using NetCore (well net5.0 now) - and need to call the project from there. I updated the CLD3.net project as described here: https://docs.microsoft.com/en-us/dotnet/core/porting/cpp-cli That worked fine in the sense that I got exactly the same error as for the .NET 4.8 version. But if you .NET 4.8 compiles then maybe it would also compile with those changes.

NikulovE commented 3 years ago

Uploaded .dll check git please. x64 version

NikulovE commented 3 years ago

Have you tried to fix include paths?

markusmobius commented 3 years ago

Yes - and that made it possible to compile the C++ CLD3 project but I got this error when compiling the CLD3.NET project. So this doesn't seem sufficient.

However, your DLL works. It even works when calling it from a net 5.0 project. However, it would be nice to compile the CLD3.NET project directly to net5.0 because I need to now install 4.8 runtime on the server. I saw that you updated the cld3.net project from 4.6 to 4.8 a few months ago - if you could update it to 5.0 and compile it would be great: https://docs.microsoft.com/en-us/dotnet/core/porting/cpp-cli

But even the 4.8 version is much appreciated.

NikulovE commented 3 years ago

Errors because: https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/c5208?view=msvc-160 Between 4.8 and 5.0 years :) I will try

markusmobius commented 3 years ago

Those compiler warnings for the CLD3 project were easy to fix:

1) On line 36 of getonescriptspan.h just name the struct (like this for example): typedef struct placeholder { char* text = nullptr; // Pointer to the span, somewhere

2) I switched error reporting to "Build Only" (not "Build + Intellisense").

Then the first project compiled for me.

NikulovE commented 3 years ago

It fixing only compilation issues, but generate issues at Linking for CLD.Net project

markusmobius commented 3 years ago

Ah! That makes sense - I guess that's why my cld3.net project did not compile.

markusmobius commented 3 years ago

I switched temporarily to VS 16.5 and the cld3 project compiles fine without any changes.

However, i still get exactly the same error when compiling cld3.net. I made no changes to the cld3.net project file except adjust the paths (replaced th NikulovE part with my username). But same error. So I think I am missing some references in the cld3.net project. Is ther anything else I have to do when compiling on different machine?

markusmobius commented 3 years ago

I forked your project and hired someone to make it compile under .NET 5.0.

https://github.com/markusmobius/cld3.net

In the process the need to for the google.zip file was removed and the include directories are relative rather than absolute so it compiles on a new machine without having to make adjustments. Maybe these changes are useful to you.

NikulovE commented 3 years ago

Thank you! I will check

NikulovE commented 6 months ago

Now repo is able to compile under .net core