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

Link Errors for nng in vs2019 #1212

Closed
foroughmajidi opened this issue Feb 27, 2020 · 11 comments
Closed

Link Errors for nng in vs2019 #1212

foroughmajidi opened this issue Feb 27, 2020 · 11 comments

Comments

@foroughmajidi
Copy link

foroughmajidi commented Feb 27, 2020

I am trying to build a nanomsg next gen (https://github.com/nanomsg/nng) on a windows box. I am using VS2019.
I am getting link errors.
the Linker/General/Additional Library Directories is:F:\nng-1.2.5\build
The .h files are read fine. But I am getting the following link errors:
Capture
These are my VS2019 settings (x64 .lib and x64 project).

Capture2

Capture3
at the end I should say that I built nng-1.2.5 as the following:

1-Download/clone NNG source
2-create Command Prompt suitable for Visual Studio:
Run x64 Visual Studio Developer Command Prompt to create a 64-bit library
3- then put cmake and Ninja in PATH environment variable
Run:
4-mkdir build && cd build
5-cmake -G Ninja -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release ..
6-ninja
please help me how to solve this problem;
thanks

@gdamore
Copy link
Contributor

gdamore commented Feb 27, 2020

Is the error in building NNG itself, or in trying to build your program(s) that use it?

@gdamore
Copy link
Contributor

gdamore commented Feb 27, 2020

(For the record, I build NNG on Windows all the time with the VS compilers. I do it from the command line though, and not in the VS GUI. I have roughly zero experience with the VS GUI.)

@jimmybutler1201
Copy link

_imp_xx means dynamic link, however your nng is build by static.

How to resolve:
right-click your vs project, properties-->C++-->Preprocessor--> Add NNG_STATIC_LIB

@jimmybutler1201
Copy link

it's not nng's problem, it's your project config

@foroughmajidi
Copy link
Author

_imp_xx means dynamic link, however your nng is build by static.

How to resolve:
right-click your vs project, properties-->C++-->Preprocessor--> Add NNG_STATIC_LIB

I had done it in the way you said but it didn't work

@foroughmajidi
Copy link
Author

Is the error in building NNG itself, or in trying to build your program(s) that use it?

I built nng and got nng.lib and nng.dll but when adding them in my project ,I got those errors that attached in first message

@foroughmajidi
Copy link
Author

(For the record, I build NNG on Windows all the time with the VS compilers. I do it from the command line though, and not in the VS GUI. I have roughly zero experience with the VS GUI.)

I built nng similar to your way in command line but my project was built in VS GUI

@foroughmajidi
Copy link
Author

foroughmajidi commented Feb 28, 2020

it's not nng's problem, it's your project config

I had done all settings and errors are related to nng
Is there any more settings required?

@jimmybutler1201
Copy link

if nng MT, then your project MT
if MTd ... MTd
...
it must be the same.

@gdamore
Copy link
Contributor

gdamore commented Feb 28, 2020

Yes. I really need to have these flags inherited in the cmake parlance. The current way NNG does this is a bit hackish, and as noted here, error prone. (There's already a ticket filed for this. I probably won't fix for 1.3, but probably in 1.4.)

@gdamore
Copy link
Contributor

gdamore commented Feb 28, 2020

I'm going to close this particular ticket, since it's clear that the problem doesn't represent a bug in NNG. (Modulo that other ticket I just referenced.)

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

3 participants