Windows cassandra-cpp-driver-2.2.2-win64-msvc140 : unable to link cassandra library

196 views
Skip to first unread message

Suleman Rai

unread,
Feb 4, 2016, 8:49:50 AM2/4/16
to DataStax C++ Driver for Apache Cassandra User Mailing List
I am trying to build a basic cassandra cpp example on eclipse using libuv-1.7.5-win64-msvc140, cassandra-cpp-driver-2.2.2-win64-msvc140 from the compiled binaries available online. During compilation it seems the linker is unable to link the cassandra library :

g++ -L"E:\libuv-1.7.5-win64-msvc140\static\lib" -L"E:\cassandra-cpp-driver-2.2.2-win64-msvc140\lib" -o "simple.exe" ./src/simple.o -llibuv -lcassandra
./src/simple.o: In function `main':
E:\workspace\simple\Debug/../src/simple.cpp:17: undefined reference to `cass_cluster_new'
collect2.exe: error: ld returned 1 exit status
make: *** [simple.exe] Error 1


I cannot figure out why this is happening. I have attached the screen shots for reference for eclipse. Any help will be appreciated.

1.png
2.png
3.png

Michael Fero

unread,
Feb 4, 2016, 9:16:12 AM2/4/16
to cpp-dri...@lists.datastax.com
Not sure why you are getting that issue when linking to the shared library; I will create a test application at some point to see if I can re-create your issue using Visual Studio 2015.. For the time being can you try linking to cassandra_static to see if using the static library is a viable workaround for now.

As a side note you mention libuv and cpp-driver binaries; however I don't see any references to the OpenSSL binaries; you will require those as well since the compiled cpp-driver on the downloads page was compiled with OpenSSL support (this is the default). If you do not need/want OpenSSL support in the driver you can compile the driver using the Windows build instructions here: http://datastax.github.io/cpp-driver/topics/building/#building-the-driver.

Fero

Suleman Rai

unread,
Feb 5, 2016, 7:30:45 AM2/5/16
to DataStax C++ Driver for Apache Cassandra User Mailing List
Dear Micheal,

I tried to use Visual Studio 2015 on Windows 8 using libuv and openssl (both libeay32 and ssleay32) binaries.I am still getting compilation errors. I also tried using cassandra_static but was not successful. I have attached screen shots for reference. Will appreciate your assistance in this regards.

Thanks,
Suleman Rai.
AdditionalDependencies.png
AdditionallibraryDirectories.png
IncludeDirectories.png
VS_2015_cpp_driver.png

Michael Fero

unread,
Feb 15, 2016, 10:10:03 AM2/15/16
to DataStax C++ Driver for Apache Cassandra User Mailing List
Suleman,

Attached is a VS 2015 solution/project (x64) using the DataStax C/C++ driver v2.2.2, libuv v1.7.5, and OpenSSL v1.0.2d binaries downloaded from downloads.datastax.com. This project creates an executable for the simple example that can be found here (https://github.com/datastax/cpp-driver/blob/master/examples/simple/simple.c). This solution/project was created from the 'Empty Project' template wizard in Visual Studio 2015 so that you can easily visually see all the changes made to the Include and Library Directories (VC++ Directories) as well as the additional dependencies (Linker->Input section).

NOTE: The example I provided in this attachment uses the static libraries and can be easily updated to accommodate the use of the shared libraries instead.

~Fero

simple.zip

Vivekananda Nayak

unread,
Aug 3, 2016, 12:40:54 PM8/3/16
to DataStax C++ Driver for Apache Cassandra User Mailing List
Dear Michael Fero ,

even i am facing same issue but windows 7 and VS 2010. Can i know why this problem..? is any workaround for windows 7 and VS 2010..

let me know

Regards
Vivek

Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

Michael Fero

unread,
Aug 4, 2016, 2:46:31 PM8/4/16
to DataStax C++ Driver for Apache Cassandra User Mailing List
Vivek,

Not sure why you are experiencing issues, but it I have a feeling that it might be due to not including all the necessary libraries that require linking; besides the basic Cassandra (or cassandra_static), libuv, and OpenSSL libraries. You will also need to add the following libraries for linking; iphlpapi, psapi, wsock32, crypt32, ws2_32, and userenv (if using libuv v1.6.0+).

I have attached a Visual Studio 2010 solution/project (x64) using the DataStax C/C++ driver v2.4.2, libuv v1.8.0, and OpenSSL v1.0.2h binaries downloaded from downloads.datastax.com. This project creates an executable for the simple example that can be found here (https://github.com/datastax/cpp-driver/blob/2.4.2/examples/simple/simple.c). This solution/project was created from the 'Empty Project' template wizard in Visual Studio 2010 along with the addition of an x64 configuration and the removal of the Win32 configuration. When you inspect the project setting you should be able to see all the changes made to the Include and Library Directories (VC++ Directories) as well as the additional dependencies (Linker->Input section).

NOTE: The example I provided in this attachment uses the static libraries and can be easily updated to accommodate the use of the shared libraries instead. Also you will want to rename the file extension from piz to zip before extracting the archive.

~Fero

simple-vs2010-x64.piz

Vivekananda Nayak

unread,
Aug 8, 2016, 7:15:20 AM8/8/16
to DataStax C++ Driver for Apache Cassandra User Mailing List

Thank you. now working fine

Reply all
Reply to author
Forward
0 new messages