Skip to content

[Q] Is there support for MSVC? #89

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

Closed
ablearthy opened this issue May 31, 2021 · 4 comments
Closed

[Q] Is there support for MSVC? #89

ablearthy opened this issue May 31, 2021 · 4 comments

Comments

@ablearthy
Copy link

ablearthy commented May 31, 2021

clickhouse-cpp located in 3rd folder.

There's my cmake file:

cmake_minimum_required(VERSION 3.16)
project(clickhouse_bench)

set(CMAKE_CXX_STANDARD 17)

add_subdirectory(3rd/clickhouse-cpp)

include_directories(3rd/clickhouse-cpp)


add_executable(clickhouse_bench main.cpp)
target_link_libraries(clickhouse_bench clickhouse-cpp-lib)

clickhouse-cpp-lib is compiled successfully, but clickhouse_bech isn't compiled because nmake can't find clickhouse-cpp-lib library. What's the problem?

UPD: set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) solved the problem, but now while starting the program Windows can't find clickhouse-cpp-lib.dll

UPD2: I put clickhouse-cpp-lib.dll into the folder where executable file is located. At least it starts, but now it fails on creating client

UPD3: I removed SetNonBlock before connect (line). Thanks, @victor-zou (#80, p. 4). Now selecting and inserting data works fine!

@filimonov
Copy link
Contributor

Can you send a PR with needed changes?

@xinstein
Copy link

xinstein commented Jan 5, 2022

In my case I get "min is not a member of std" when compiling with msvc,

but when compiling with mingw64 both targets (clickhouse-cpp-lib and my-test-executable) compiles fine, but I also need to manually copy the libclickhouse-cpp-lib.dll into the executable-residing directory.

The same project structure and code works totally fine on linux, but I need it on Windows.

  1. Will there be a performance degradation in using mingw instead of msvc?
  2. Even I chose mingw, why do I have to copy the clickhouse-cpp-lib.dll into executable directory in order to make it executable?

@xinstein
Copy link

xinstein commented Jan 5, 2022

In my case I get "min is not a member of std" when compiling with msvc,

but when compiling with mingw64 both targets (clickhouse-cpp-lib and my-test-executable) compiles fine, but I also need to manually copy the libclickhouse-cpp-lib.dll into the executable-residing directory.

The same project structure and code works totally fine on linux, but I need it on Windows.

  1. Will there be a performance degradation in using mingw instead of msvc?
  2. Even I chose mingw, why do I have to copy the clickhouse-cpp-lib.dll into executable directory in order to make it executable?

I forgot to mention that I also need to add this line to clickhouse/CMakeList.txt:

target_link_libraries(clickhouse-cpp-lib ws2_32)

the same line is not needed on linux, where I can compile and run fine with all the code in repo as-is

@Enmk
Copy link
Contributor

Enmk commented Feb 16, 2022

Fixed in #130

@Enmk Enmk closed this as completed Feb 16, 2022
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

4 participants