questdb / c-questdb-client

Rust, C and C++ client for QuestDB InfluxDB Line Protocol
Apache License 2.0
47 stars 13 forks source link

error LNK2019: unresolved external symbol __imp_NtCreateFile referenced in function ... #40

Closed fmvin closed 1 year ago

fmvin commented 1 year ago

Reqs: Build the c-questdb-client lib and link it to a cpp project Setup: Windows Server 2019 Standard, MS Visual Studio 2022 v.17.7.3 Steps to reproduce: Just build c-questdb-client library in Visual Studio. Output: the same errors for all .c and .cpp examples

FAILED: line_sender_cpp_example.exe 
cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\line_sender_cpp_example.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x64\mt.exe --manifests  -- C:\PROGRA~1\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1437~1.328\bin\Hostx64\x64\link.exe /nologo CMakeFiles\line_sender_cpp_example.dir\examples\line_sender_cpp_example.cpp.obj  /out:line_sender_cpp_example.exe /implib:line_sender_cpp_example.lib /pdb:line_sender_cpp_example.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console  questdb_client.lib  advapi32.lib  userenv.lib  ws2_32.lib  bcrypt.lib  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
LINK Pass 1: command "C:\PROGRA~1\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1437~1.328\bin\Hostx64\x64\link.exe /nologo CMakeFiles\line_sender_cpp_example.dir\examples\line_sender_cpp_example.cpp.obj /out:line_sender_cpp_example.exe /implib:line_sender_cpp_example.lib /pdb:line_sender_cpp_example.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console questdb_client.lib advapi32.lib userenv.lib ws2_32.lib bcrypt.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\line_sender_cpp_example.dir/intermediate.manifest CMakeFiles\line_sender_cpp_example.dir/manifest.res" failed (exit code 1120) with the following output:
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
questdb_client.lib(std-0f357f0f8e8eb48f.std.895242974ff7d01b-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_NtCreateFile referenced in function _ZN3std3sys7windows2fs20open_link_no_reparse17h262f7b3e7853935cE
questdb_client.lib(std-0f357f0f8e8eb48f.std.895242974ff7d01b-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_RtlNtStatusToDosError referenced in function _ZN3std3sys7windows2fs20open_link_no_reparse17h262f7b3e7853935cE
questdb_client.lib(std-0f357f0f8e8eb48f.std.895242974ff7d01b-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_NtReadFile referenced in function _ZN3std3sys7windows6handle6Handle16synchronous_read17h00067f19ba39bde9E
questdb_client.lib(std-0f357f0f8e8eb48f.std.895242974ff7d01b-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_NtWriteFile referenced in function _ZN3std3sys7windows6handle6Handle17synchronous_write17h977c567d7f264f32E
line_sender_cpp_example.exe : fatal error LNK1120: 4 unresolved externals

Also if to try to link the library to a test project (created in accordance with DEPENDENCY.md) the errors are same.

amunra commented 1 year ago

Reproduced. This will be fixed in the next version of our lib. I'm currently working on a few minor additions and bug fixes. I'll keep you posted.

Thanks for the bug report!

fmvin commented 1 year ago

@amunra, when do you plan the next release?

amunra commented 1 year ago

Once the bug is fixed 😊.

This used to work, now on re-run our CI fails too. Ah, good old CMake.

A few days, I presume.

amunra commented 1 year ago

This should be fix as per the latest release 3.0.0.