compilation

compile protobuf client code on ubuntu, but include file is not found

浪子不回头ぞ 提交于 2020-07-21 11:39:33
问题 I just installed google protocol buffer on my ubuntu1604: sudo apt install protobuf-compiler And tried a quick test, 1 proto file, 1 cpp file to use it, try to see the encode/decode results: $ cat 1.proto package x; message my{ required string name=1; required int32 id=2; optional string email=3; } $ cat 1.cpp #include"1.pb.cc" #include<string> #include<iostream> using namespace std; using namespace x; int main() { my p; p.set_name("tom"); p.set_id(18); p.set_email("aa@bb.com"); string s; my

compile protobuf client code on ubuntu, but include file is not found

痴心易碎 提交于 2020-07-21 11:30:26
问题 I just installed google protocol buffer on my ubuntu1604: sudo apt install protobuf-compiler And tried a quick test, 1 proto file, 1 cpp file to use it, try to see the encode/decode results: $ cat 1.proto package x; message my{ required string name=1; required int32 id=2; optional string email=3; } $ cat 1.cpp #include"1.pb.cc" #include<string> #include<iostream> using namespace std; using namespace x; int main() { my p; p.set_name("tom"); p.set_id(18); p.set_email("aa@bb.com"); string s; my

Distutils setup generate .so and not .dylib on Mac OS X

时光毁灭记忆、已成空白 提交于 2020-07-19 07:03:05
问题 I've been trying to create C bindings for a Python library following an official tutorial presented by the developer of the latter library using Cython (https://www.ibisc.univ-evry.fr/~fpommereau/SNAKES/snakes-out-of-python.html). The cythonization of the library works perfectly. However, when calling the creation of the library file with distutils.core.setup on Mac OS X 10.10.5 , it produces a file .so . However, when I need to compile the example .c file with the library, I end up having

instruction point value of dynamic linking and static linking

允我心安 提交于 2020-07-09 11:54:09
问题 By using Intel's pin, I printed out the instruction pointer (ip) values for a program with dynamic linking and static linking. And I've found that their ip values are quite different, even though they are the same program. A program with static linking shows 0x400f50 for its very first ip value. but a program with dynamic linking shows 0x7f94f0762090 for its first ip value I am not sure why they have that quite a large gap. It would be appreciated if anyone could help me find out the reason

Minimal set of files required to distribute an embed-Cython-compiled code and make it work on any machine

不羁的心 提交于 2020-06-30 10:19:06
问题 TL;DR: how to use Cython as a distribution method instead of Py2exe, cx_freeze, pyinstaller, etc. Following Making an executable in Cython, I'd like to see how it could be possible to distribute a Python program to any Windows user (who doesn't have Python already installed on his machine) by compiling it first with Cython --embed . Let's use a test.py : import json print(json.dumps({'key': 'hello world'})) and compile it: cython test.py --embed call "C:\Program Files (x86)\Microsoft Visual

What are all the ILLEGAL_CHARACTERS from openpyxl?

爱⌒轻易说出口 提交于 2020-06-29 04:07:42
问题 We are running into a problem when parsing emails with python from outlook. Sometimes emails have characters that are not able to be appended to an excel worksheet using openpyxl. The error it raises is just IllegalCharacterError . I am trying to force this to print out the actual characters that are considered "Illegal". That said while doing some digging in one of the files in opnepyxl I found on cell.py this line that raises the error. if next(ILLEGAL_CHARACTERS_RE.finditer(value), None):

How to compile CHOLMOD library (SuiteSparse) from IDE

三世轮回 提交于 2020-06-28 18:02:56
问题 For some time I am trying to create a static CHOLMOD lib from SuiteSparse Each other library (f.ex. Umfpack) can be easiy compiled from IDE (I used Code::Blocks on Linux and Visual Studio on Windows). However when trying to compile CHOLMOD I get bunch of syntax errors like: t_cholmod_triplet.c(21): error C2061: syntax error : identifier 'TEMPLATE' I investigated that there are some #defines missing (like PATTERN, REAL defines) and therefore those definitions of TEMPLATE are invisible. I

Overload Resolution differs between compilers

不问归期 提交于 2020-06-27 07:35:51
问题 I have constructed the following minimal example of my problem: #include <iostream> struct Foo { Foo() { std::cout << "default" << std::endl; } Foo(Foo& f2) { std::cout << "non-const" << std::endl; } Foo(const Foo& f2) { std::cout << "const" << std::endl; } }; int main() { std::pair<Foo, int> foop0(Foo(), 1); std::cout << std::endl; std::pair<const Foo, int>foop1(foop0); } On my Ubuntu machine g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 will print out the following: $ g++ -std=c++14 test.cpp -o

Overload Resolution differs between compilers

大兔子大兔子 提交于 2020-06-27 07:35:48
问题 I have constructed the following minimal example of my problem: #include <iostream> struct Foo { Foo() { std::cout << "default" << std::endl; } Foo(Foo& f2) { std::cout << "non-const" << std::endl; } Foo(const Foo& f2) { std::cout << "const" << std::endl; } }; int main() { std::pair<Foo, int> foop0(Foo(), 1); std::cout << std::endl; std::pair<const Foo, int>foop1(foop0); } On my Ubuntu machine g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 will print out the following: $ g++ -std=c++14 test.cpp -o

sqrt of uint64_t vs. int64_t

有些话、适合烂在心里 提交于 2020-06-27 07:26:54
问题 I noticed that calculating the integer part of square root of uint64_t is much more complicated than of int64_t . Please, does anybody have an explanation for this? Why is it seemingly much more difficult to deal with one extra bit? The following: int64_t sqrt_int(int64_t a) { return sqrt(a); } compiles with clang 5.0 and -mfpmath=sse -msse3 -Wall -O3 to sqrt_int(long): # @sqrt_int(long) cvtsi2sd xmm0, rdi sqrtsd xmm0, xmm0 cvttsd2si rax, xmm0 ret But the following: uint64_t sqrt_int(uint64_t