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

Error LNK2019 #70

Closed
Frp529 opened this issue Nov 8, 2022 · 5 comments
Closed

Error LNK2019 #70

Frp529 opened this issue Nov 8, 2022 · 5 comments
Labels
fix added A fix was added but has yet to be fully tested/verified
Milestone

Comments

@Frp529
Copy link

Frp529 commented Nov 8, 2022

Hi guys,

I created a C++ project with VS 2019 and related head files and a library are added to the project. Unfortunately, it is unable to build successfully. Are there some critical steps I've overlooked?

1667915884206

@fpagliughi
Copy link
Owner

Apologies, I don't know Windows very well. It seems like it says that it's linking to the sockpp library, but the errors make it seem like it's not.

I just released an update (v0.8.0) with a bunch of changes to the CMake files. I wonder if anything in there helps, or if not just changes the result.

Can you give it a try with the latest version?

Either way, there's a number of outstanding issues with the Windows build, so I will try to get them fixed shortly.

@fpagliughi fpagliughi added this to the v0.8.1 milestone Jan 18, 2023
@fpagliughi
Copy link
Owner

I just tried it with the latest release, v0.8.0, and got some unresolved symbols from the linker, but they appeared to be the system calls.

I manually had to add the library dependency: ws2_32.lib

Once I did, it built and ran fine. Let me know if that helps. (Perhaps the transitive dependency in CMake doesn't work for static libs in Windows?)

Also... if you build the library with CMake on Windows, it creates a sockpp.sln with project files like sockpp-static.vcxproj. It seems like you can just add those to your project, if you keep them on your machine. But it seems like you still need to add ws2_32.lib to your app project.

@fpagliughi
Copy link
Owner

Also note that the DLL now seems to build properly on Windows with v0.8.0... and the DLL appears to link in the required system libraries. So you can give that a try as well.

Build sockpp with -DSOCKPP_BUILD_SHARED=ON (which is now the default), then link your app to sockpp.lib and make sure sockpp.dll is in the path.

@fpagliughi
Copy link
Owner

I'm hoping the fix for #38 (f263fb7) also fixed this. If not, please let me know.

@fpagliughi fpagliughi added the fix added A fix was added but has yet to be fully tested/verified label Jan 30, 2023
fpagliughi added a commit that referenced this issue Jan 30, 2023
@fpagliughi
Copy link
Owner

I hope this is fixed by the updated CMake build in v0.8.1.
If not please re-open this issue with any new information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix added A fix was added but has yet to be fully tested/verified
Projects
None yet
Development

No branches or pull requests

2 participants