- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我在 ubuntu14.04 上运行。我能够在机器上安装 datastax 的 cpp 驱动程序。
但是我无法运行它的任何示例
Install the project...
-- Install configuration: ""
-- Up-to-date: /usr/local/include/cassandra.h
-- Up-to-date: /usr/local/lib/libcassandra.so.0.7.0
-- Up-to-date: /usr/local/lib/libcassandra.so.0
-- Up-to-date: /usr/local/lib/libcassandra.so
-- Up-to-date: /usr/local/lib/libcassandra_static.a
root@ubuntu-cassandra:~/cpp-driver# cd -
/root/cpp-driver/examples/simple
root@ubuntu-cassandra:~/cpp-driver/examples/simple# strace -s 1024 -f -e execve gcc -I /usr/local/include/ -L /usr/local/lib/ -lcassandra simple.c
execve("/usr/bin/gcc", ["gcc", "-I", "/usr/local/include/", "-L", "/usr/local/lib/", "-lcassandra", "simple.c"], [/* 23 vars */]) = 0
Process 30450 attached
[pid 30450] execve("/usr/lib/gcc/x86_64-linux-gnu/4.8/cc1", ["/usr/lib/gcc/x86_64-linux-gnu/4.8/cc1", "-quiet", "-I", "/usr/local/include/", "-imultiarch", "x86_64-linux-gnu", "simple.c", "-quiet", "-dumpbase", "simple.c", "-mtune=generic", "-march=x86-64", "-auxbase", "simple", "-fstack-protector", "-Wformat", "-Wformat-security", "-o", "/tmp/cc8RgD1Y.s"], [/* 26 vars */]) = 0
[pid 30450] +++ exited with 0 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=30450, si_status=0, si_utime=3, si_stime=1} ---
Process 30451 attached
[pid 30451] execve("/usr/local/sbin/as", ["as", "-I", "/usr/local/include/", "--64", "-o", "/tmp/ccCetiDS.o", "/tmp/cc8RgD1Y.s"], [/* 26 vars */]) = -1 ENOENT (No such file or directory)
[pid 30451] execve("/usr/local/bin/as", ["as", "-I", "/usr/local/include/", "--64", "-o", "/tmp/ccCetiDS.o", "/tmp/cc8RgD1Y.s"], [/* 26 vars */]) = -1 ENOENT (No such file or directory)
[pid 30451] execve("/usr/sbin/as", ["as", "-I", "/usr/local/include/", "--64", "-o", "/tmp/ccCetiDS.o", "/tmp/cc8RgD1Y.s"], [/* 26 vars */]) = -1 ENOENT (No such file or directory)
[pid 30451] execve("/usr/bin/as", ["as", "-I", "/usr/local/include/", "--64", "-o", "/tmp/ccCetiDS.o", "/tmp/cc8RgD1Y.s"], [/* 26 vars */]) = 0
[pid 30451] +++ exited with 0 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=30451, si_status=0, si_utime=0, si_stime=0} ---
Process 30452 attached
[pid 30452] execve("/usr/lib/gcc/x86_64-linux-gnu/4.8/collect2", ["/usr/lib/gcc/x86_64-linux-gnu/4.8/collect2", "--sysroot=/", "--build-id", "--eh-frame-hdr", "-m", "elf_x86_64", "--hash-style=gnu", "--as-needed", "-dynamic-linker", "/lib64/ld-linux-x86-64.so.2", "-z", "relro", "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crt1.o", "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crti.o", "/usr/lib/gcc/x86_64-linux-gnu/4.8/crtbegin.o", "-L/usr/local/lib/", "-L/usr/lib/gcc/x86_64-linux-gnu/4.8", "-L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu", "-L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib", "-L/lib/x86_64-linux-gnu", "-L/lib/../lib", "-L/usr/lib/x86_64-linux-gnu", "-L/usr/lib/../lib", "-L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../..", "-lcassandra", "/tmp/ccCetiDS.o", "-lgcc", "--as-needed", "-lgcc_s", "--no-as-needed", "-lc", "-lgcc", "--as-needed", "-lgcc_s", "--no-as-needed", "/usr/lib/gcc/x86_64-linux-gnu/4.8/crtend.o", "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crtn.o"], [/* 28 vars */]) = 0
Process 30453 attached
[pid 30453] execve("/usr/bin/ld", ["/usr/bin/ld", "--sysroot=/", "--build-id", "--eh-frame-hdr", "-m", "elf_x86_64", "--hash-style=gnu", "--as-needed", "-dynamic-linker", "/lib64/ld-linux-x86-64.so.2", "-z", "relro", "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crt1.o", "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crti.o", "/usr/lib/gcc/x86_64-linux-gnu/4.8/crtbegin.o", "-L/usr/local/lib/", "-L/usr/lib/gcc/x86_64-linux-gnu/4.8", "-L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu", "-L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib", "-L/lib/x86_64-linux-gnu", "-L/lib/../lib", "-L/usr/lib/x86_64-linux-gnu", "-L/usr/lib/../lib", "-L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../..", "-lcassandra", "/tmp/ccCetiDS.o", "-lgcc", "--as-needed", "-lgcc_s", "--no-as-needed", "-lc", "-lgcc", "--as-needed", "-lgcc_s", "--no-as-needed", "/usr/lib/gcc/x86_64-linux-gnu/4.8/crtend.o", "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crtn.o"], [/* 28 vars */]) = 0
[pid 30453] +++ exited with 1 +++
[pid 30452] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=30453, si_status=1, si_utime=2, si_stime=1} ---
/tmp/ccCetiDS.o: In function `main':
simple.c:(.text+0x1b): undefined reference to `cass_cluster_new'
simple.c:(.text+0x88): undefined reference to `cass_cluster_setopt'
simple.c:(.text+0xae): undefined reference to `cass_cluster_connect'
simple.c:(.text+0xc4): undefined reference to `cass_future_wait'
simple.c:(.text+0xd3): undefined reference to `cass_future_error_code'
simple.c:(.text+0xf5): undefined reference to `cass_future_get_session'
simple.c:(.text+0x116): undefined reference to `cass_string_init'
simple.c:(.text+0x13b): undefined reference to `cass_statement_new'
simple.c:(.text+0x155): undefined reference to `cass_session_execute'
simple.c:(.text+0x165): undefined reference to `cass_future_wait'
simple.c:(.text+0x171): undefined reference to `cass_future_error_code'
simple.c:(.text+0x190): undefined reference to `cass_future_get_result'
simple.c:(.text+0x1a0): undefined reference to `cass_iterator_from_result'
simple.c:(.text+0x1b5): undefined reference to `cass_iterator_get_row'
simple.c:(.text+0x1ca): undefined reference to `cass_row_get_column'
simple.c:(.text+0x1d9): undefined reference to `cass_value_get_string'
simple.c:(.text+0x1ea): undefined reference to `cass_row_get_column'
simple.c:(.text+0x1fc): undefined reference to `cass_value_get_bool'
simple.c:(.text+0x20d): undefined reference to `cass_row_get_column'
simple.c:(.text+0x21c): undefined reference to `cass_value_get_string'
simple.c:(.text+0x22d): undefined reference to `cass_row_get_column'
simple.c:(.text+0x23c): undefined reference to `cass_value_get_string'
simple.c:(.text+0x295): undefined reference to `cass_iterator_next'
simple.c:(.text+0x2a9): undefined reference to `cass_result_free'
simple.c:(.text+0x2b5): undefined reference to `cass_iterator_free'
simple.c:(.text+0x2c3): undefined reference to `cass_future_error_message'
simple.c:(.text+0x2fa): undefined reference to `cass_future_free'
simple.c:(.text+0x309): undefined reference to `cass_session_close'
simple.c:(.text+0x319): undefined reference to `cass_future_wait'
simple.c:(.text+0x32a): undefined reference to `cass_future_error_message'
simple.c:(.text+0x364): undefined reference to `cass_future_free'
simple.c:(.text+0x373): undefined reference to `cass_cluster_free'
collect2: error: ld returned 1 exit status
[pid 30452] +++ exited with 1 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=30452, si_status=1, si_utime=0, si_stime=0} ---
+++ exited with 1 +++
我无法推断出为什么会发生这种情况,因为路径中存在库另一个调试输出:link
在进一步调查中,我分别编译和链接了这些文件。还是没有进展
root@ubuntu-cassandra:~/cpp-driver/examples/simple# g++ -g -v -o simpler -L /usr/local/lib/ -lcassandra simple.o
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.2-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-g' '-v' '-o' 'simpler' '-L/usr/local/lib/' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
/usr/lib/gcc/x86_64-linux-gnu/4.8/collect2 --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z relro -o simpler /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.8/crtbegin.o -L/usr/local/lib/ -L/usr/lib/gcc/x86_64-linux-gnu/4.8 -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../.. -lcassandra simple.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/4.8/crtend.o /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crtn.o
simple.o: In function `main':
simple.c:(.text+0x1b): undefined reference to `cass_cluster_new'
simple.c:(.text+0x88): undefined reference to `cass_cluster_setopt'
simple.c:(.text+0xae): undefined reference to `cass_cluster_connect'
simple.c:(.text+0xc4): undefined reference to `cass_future_wait'
simple.c:(.text+0xd3): undefined reference to `cass_future_error_code'
simple.c:(.text+0xf5): undefined reference to `cass_future_get_session'
simple.c:(.text+0x116): undefined reference to `cass_string_init'
simple.c:(.text+0x13b): undefined reference to `cass_statement_new'
simple.c:(.text+0x155): undefined reference to `cass_session_execute'
simple.c:(.text+0x165): undefined reference to `cass_future_wait'
simple.c:(.text+0x171): undefined reference to `cass_future_error_code'
simple.c:(.text+0x190): undefined reference to `cass_future_get_result'
simple.c:(.text+0x1a0): undefined reference to `cass_iterator_from_result'
simple.c:(.text+0x1b5): undefined reference to `cass_iterator_get_row'
simple.c:(.text+0x1ca): undefined reference to `cass_row_get_column'
simple.c:(.text+0x1d9): undefined reference to `cass_value_get_string'
simple.c:(.text+0x1ea): undefined reference to `cass_row_get_column'
simple.c:(.text+0x1fc): undefined reference to `cass_value_get_bool'
simple.c:(.text+0x20d): undefined reference to `cass_row_get_column'
simple.c:(.text+0x21c): undefined reference to `cass_value_get_string'
simple.c:(.text+0x22d): undefined reference to `cass_row_get_column'
simple.c:(.text+0x23c): undefined reference to `cass_value_get_string'
simple.c:(.text+0x295): undefined reference to `cass_iterator_next'
simple.c:(.text+0x2a9): undefined reference to `cass_result_free'
simple.c:(.text+0x2b5): undefined reference to `cass_iterator_free'
simple.c:(.text+0x2c3): undefined reference to `cass_future_error_message'
simple.c:(.text+0x2fa): undefined reference to `cass_future_free'
simple.c:(.text+0x309): undefined reference to `cass_session_close'
simple.c:(.text+0x319): undefined reference to `cass_future_wait'
simple.c:(.text+0x32a): undefined reference to `cass_future_error_message'
simple.c:(.text+0x364): undefined reference to `cass_future_free'
simple.c:(.text+0x373): undefined reference to `cass_cluster_free'
collect2: error: ld returned 1 exit status
root@ubuntu-cassandra:~/cpp-driver/examples/simple# nm simple.o
U cass_cluster_connect
U cass_cluster_free
U cass_cluster_new
U cass_cluster_setopt
U cass_future_error_code
U cass_future_error_message
U cass_future_free
U cass_future_get_result
U cass_future_get_session
U cass_future_wait
U cass_iterator_free
U cass_iterator_from_result
U cass_iterator_get_row
U cass_iterator_next
U cass_result_free
U cass_row_get_column
U cass_session_close
U cass_session_execute
U cass_statement_new
U cass_string_init
U cass_value_get_bool
U cass_value_get_string
U fprintf
0000000000000000 T main
U printf
U stderr
U strlen
最佳答案
您需要在命令中使用“-lcassandra”而不是“simple.o”:
g++ simple.o -g -o simpler -L/usr/local/lib/ -lcassandra
这是我找到的解释原因的答案:Why does the order of '-l' option in gcc matter?
关于c++ - 运行 datastax 的 cpp-driver 示例时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24571384/
#include using namespace std; class C{ private: int value; public: C(){ value = 0;
这个问题已经有答案了: What is the difference between char a[] = ?string?; and char *p = ?string?;? (8 个回答) 已关闭
关闭。此题需要details or clarity 。目前不接受答案。 想要改进这个问题吗?通过 editing this post 添加详细信息并澄清问题. 已关闭 7 年前。 此帖子已于 8 个月
除了调试之外,是否有任何针对 c、c++ 或 c# 的测试工具,其工作原理类似于将独立函数复制粘贴到某个文本框,然后在其他文本框中输入参数? 最佳答案 也许您会考虑单元测试。我推荐你谷歌测试和谷歌模拟
我想在第二台显示器中移动一个窗口 (HWND)。问题是我尝试了很多方法,例如将分辨率加倍或输入负值,但它永远无法将窗口放在我的第二台显示器上。 关于如何在 C/C++/c# 中执行此操作的任何线索 最
我正在寻找 C/C++/C## 中不同类型 DES 的现有实现。我的运行平台是Windows XP/Vista/7。 我正在尝试编写一个 C# 程序,它将使用 DES 算法进行加密和解密。我需要一些实
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 1
有没有办法强制将另一个 窗口置于顶部? 不是应用程序的窗口,而是另一个已经在系统上运行的窗口。 (Windows, C/C++/C#) 最佳答案 SetWindowPos(that_window_ha
假设您可以在 C/C++ 或 Csharp 之间做出选择,并且您打算在 Windows 和 Linux 服务器上运行同一服务器的多个实例,那么构建套接字服务器应用程序的最明智选择是什么? 最佳答案 如
你们能告诉我它们之间的区别吗? 顺便问一下,有什么叫C++库或C库的吗? 最佳答案 C++ 标准库 和 C 标准库 是 C++ 和 C 标准定义的库,提供给 C++ 和 C 程序使用。那是那些词的共同
下面的测试代码,我将输出信息放在注释中。我使用的是 gcc 4.8.5 和 Centos 7.2。 #include #include class C { public:
很难说出这里问的是什么。这个问题是含糊的、模糊的、不完整的、过于宽泛的或修辞性的,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开它,visit the help center 。 已关
我的客户将使用名为 annoucement 的结构/类与客户通信。我想我会用 C++ 编写服务器。会有很多不同的类继承annoucement。我的问题是通过网络将这些类发送给客户端 我想也许我应该使用
我在 C# 中有以下函数: public Matrix ConcatDescriptors(IList> descriptors) { int cols = descriptors[0].Co
我有一个项目要编写一个函数来对某些数据执行某些操作。我可以用 C/C++ 编写代码,但我不想与雇主共享该函数的代码。相反,我只想让他有权在他自己的代码中调用该函数。是否可以?我想到了这两种方法 - 在
我使用的是编写糟糕的第 3 方 (C/C++) Api。我从托管代码(C++/CLI)中使用它。有时会出现“访问冲突错误”。这使整个应用程序崩溃。我知道我无法处理这些错误[如果指针访问非法内存位置等,
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 7 年前。
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于 Stack Overflow 来说是偏离主题的,因为
我有一些 C 代码,将使用 P/Invoke 从 C# 调用。我正在尝试为这个 C 函数定义一个 C# 等效项。 SomeData* DoSomething(); struct SomeData {
这个问题已经有答案了: Why are these constructs using pre and post-increment undefined behavior? (14 个回答) 已关闭 6
我是一名优秀的程序员,十分优秀!