g++

Undefined reference to `cv::String::deallocate()' error in OpenCV 3.4.3 [duplicate]

青春壹個敷衍的年華 提交于 2019-12-13 16:21:14
问题 This question already has answers here : What is an undefined reference/unresolved external symbol error and how do I fix it? (32 answers) Closed last year . I recently installed OpenCV 3.4.3 But some libraries in OpenCV are not running. This is my example code. #include<iostream> #include "opencv2/imgproc.hpp" #include "opencv2/core.hpp" #include "opencv2/highgui.hpp" #include "opencv2/opencv.hpp" int main(int argc, char** argv){ } And this is the comment I entered g++ tmp.cpp And the

How to use linked libraries compiled with libc++ libstdc++ mixed

╄→гoц情女王★ 提交于 2019-12-13 16:06:54
问题 I am trying to write a script that uses a library compiled with clang and another library compiled with G++, I get the following error: ld.lld: error: undefined symbol: myFunction() Which (according to this Difference between string and char[] types in C++) is apparently due to std::string meaning different things in different versions of G++ and clang. Does this mean I have to rewrite the Makefile of my target library to use the same version of G++/Clang? Because that seems like an awful

Constant embedded for loop condition optimization in C++ with gcc

∥☆過路亽.° 提交于 2019-12-13 16:06:20
问题 Will a compiler optimize tihs: bool someCondition = someVeryTimeConsumingTask(/* ... */); for (int i=0; i<HUGE_INNER_LOOP; ++i) { if (someCondition) doCondition(i); else bacon(i); } into: bool someCondition = someVeryTimeConsumingTask(/* ... */); if (someCondition) for (int i=0; i<HUGE_INNER_LOOP; ++i) doCondition(i); else for (int i=0; i<HUGE_INNER_LOOP; ++i) bacon(i); someCondition is trivially constant within the for loop. This may seem obvious and that I should do this myself, but if you

Linking a .lib file on Windows 7

孤者浪人 提交于 2019-12-13 16:02:49
问题 I have a C++ program test.cpp and I want to link two .lib files to it(fhlib.lib and gc_lib.lib).I have the .lib files in the same folder as my .cpp program. I'm on Windows 7. What I have tried so far is the following: g++ -o main main.cpp -L/Users\Documents\Visual Studio 2015\Projects\My Project -lfhlib But I get an No such file or directory error. I'm sure the path is correct because I copied it from Properties->Location. But I had do delete the "C:\", because it was not compiling. EDIT: I

How to solve C++ conflicts between system and library dependencies

若如初见. 提交于 2019-12-13 15:03:45
问题 My problem is rather specific, but bear with me. This in the end is kinda reverse engineering, but this problem in particular seems to fit more this board. So, I have a shared object compiled for MIPS written in C++. I don't have the source code of the lib. The lib is compiled using GCC 4.3.3. I want to use functions present in this shared object in my amd64 computer running elementary OS. To do this, I used the sourcery cross compiler to cross compile some C++ code to MIPS, that would use

Include static lib in dynamic lib

最后都变了- 提交于 2019-12-13 15:02:50
问题 I have the following problem : several object files a1.o, a2.o, a3.o, ... an archive libxxxx.a. The archive libxxxx.a only contains object files : b1.o, b2.o etc... I would like to create a shared library (.so) from all the object files. Problem : If I use : g++ -shared libxxxx.a a1.o a2.o ... -o libnew.so g++ does understand that I want to link with the static library libxxxx.a and does not include all the symbols of the archive. A simple workaround is to first expand the archive using ar -x

-D option is expanded incorrectly from g++ command line

倖福魔咒の 提交于 2019-12-13 14:39:23
问题 In C++ CodeBlocks project I added the following definitions to the project settings, compiler settings, #define: _DEBUG DATA_DIR=\"/media/Shared/SiX/Data\" This produces the following g++ command line: g++ -Wall -g -fPIC -save-temps -D_DEBUG -DDATA_DIR=\"/media/Shared/SiX/Data\" -I../Includes -c /media/Shared/SiX/SiXConfiguration/PathManager.cpp -o obj/Debug/PathManager.o This code does not compile: char* commonDataDir; #ifdef DATA_DIR commonDataDir = DATA_DIR; #endif Looking at preprocessor

Armadillo installation

流过昼夜 提交于 2019-12-13 14:30:24
问题 Hi I installed Armadillo3.0.1 in my own working directory /home/me/package/armadillo3.0.1/ as the README.txt said. But when I try an example: g++ -I /home/me/package/armadillo3.0.1/usr/include/ example.cpp -o example -O1 It always shows the error: /tmp/ccZAE9pj.o: In function void arma::gemm<false, false, false, false>::apply_blas_type<double>(arma::Mat<double>&, arma::Mat<double> const&, arma::Mat<double> const&, double, double)': example.cpp:(.text._ZN4arma4gemmILb0ELb0ELb0ELb0EE15apply

g++ unable to link OpenAL Libraries

这一生的挚爱 提交于 2019-12-13 14:18:36
问题 I have trouble compiling the following code #include <AL/al.h> #include <AL/alc.h> #include <iostream> int checkEnumerationSupport() { ALboolean enumeration; enumeration = alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT"); if (enumeration == AL_FALSE) { // enumeration not supported std::cout << "enumerating devices NOT supported\n"; } else { // enumeration supported std::cout << "enumerating devices supported\n"; }; return 0; } int main() { checkEnumerationSupport(); } using the command

Cannot decode an obscured compiler error in g++ when user custom hash function in unordered_map

喜欢而已 提交于 2019-12-13 14:15:56
问题 Here is the code I am trying to compile: #include <unordered_map> #include <unordered_set> #include <algorithm> #include <iostream> #include <sstream> #include <vector> #include <string> using namespace std; namespace _LEET_MAX_POINTS_ON_A_LINE { struct Point { int x; int y; Point() : x(0), y(0) {} Point(int a, int b) : x(a), y(b) {} }; struct SlantedLine { public: int slope_numerator; int slope_denominator; int intercept_numerator; int intercept_denominator; }; struct SlantedLineHash { size