g++

error: conflicting declaration - cant a pointer be an int?

 ̄綄美尐妖づ 提交于 2019-12-12 04:35:58
问题 I am trying to compile a library, when running make I get many of the following errors: error: conflicting declaration ‘int x’ error: ‘x’ has a previous declaration as ‘Text* x’ Here is the code: . . . class Text; class Code { private: std::vector<std::string> *tokens; std::vector<std::string> *compounds; std::vector<std::string> *compound_xml; std::vector<std::string> *compound_xml_action; void set_helper(Text *x, int a, int b, int c, std::string field, std::string value); std::string itoa

Linking libjpeg library to a shared library, and libjpeg is undefined at runtime

▼魔方 西西 提交于 2019-12-12 04:22:33
问题 I am trying to use libjpeg in my jni program on Ubuntu. I built my c++ code with g++, with libjpeg added as a library. I tried both linking the shared version and the static version, but both of them cause "undefined symbol: jpeg_std_error" error in Java (while my c++ codes worked fine). I did use "extern "C"" for the libjpeg header. Here is my build script with static libjpeg.a (libjpeg built as part of libjpeg-turbo and renamed libjpeg151.a): outputName=$libDir/libMyLib.so g++ -DNDEBUG -O3

C++ unordered_map using a custom class type as the key

独自空忆成欢 提交于 2019-12-12 04:17:02
问题 I am trying to use a custom class as key for an unordered_map , like the following: #include <iostream> #include <algorithm> #include <unordered_map> using namespace std; class node; class Solution; class Node { public: int a; int b; int c; Node(){} Node(vector<int> v) { sort(v.begin(), v.end()); a = v[0]; b = v[1]; c = v[2]; } bool operator==(Node i) { if ( i.a==this->a && i.b==this->b &&i.c==this->c ) { return true; } else { return false; } } }; int main() { unordered_map<Node, int> m;

Linking SFML in CodeLite

半腔热情 提交于 2019-12-12 04:15:57
问题 Ok so I am trying to link SFML in a CodeLite project but with no success. So what have I done : Added the include folder of SFML to the IncludePaths of CodeLite. Added the lib folder of SFML to the LibrariesSearchPath of CodeLite. Added SFML_STATIC to Preprocessors in CodeLite. Added the libraries to the LinkerOptions like this : sfml-graphics;sfml-window;sfml-audio;sfml-network;sfml-system Added the 5 dll's(sfml-graphics-2.dll.. etc) to the debug folder and to the project folder This is the

g++: No such file or directory?

放肆的年华 提交于 2019-12-12 04:03:20
问题 (On Linux, trying to set up SDL) I'm having a time with makefiles, I'm finding them hard to learn. Here is the error I'm getting. g++: error: game.exe: No such file or directory make: *** [game.exe] Error 1 Here is my makefile. (Any suggestions on making it better would be great. I've just kind of slapped together whatever I could find to work.) #Game Make file TARGET = game.exe OBJS = App.o\ App_OnInit.o\ App_OnEvent.o\ App_OnLoop.o\ App_OnRender.o \ App_OnCleanup.o\ SDL_CFLAGS := $(shell

Visual Studio equivalent for these G++ flags?

人走茶凉 提交于 2019-12-12 03:32:29
问题 I am compiling a project that uses CMake which assumes the compiler is G++, but I am actually using Visual Studio 2013. In the CMakeLists.txt file, I encountered the line set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra -pedantic") I think I ought to replace with something like if(MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ????") # what goes here?? else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra -pedantic") endif() I am fairly new to the world of

'explicit' keyword in g++ has no effect for simple constructor (not copy/assignment constructor)? [duplicate]

百般思念 提交于 2019-12-12 03:23:22
问题 This question already has answers here : What does the explicit keyword mean? (11 answers) Closed 4 years ago . Can anyone explain why the following code compiles? I expect it to get an error where the double constant 3.3 can not be converted to int , since I declare the constructor to be explicit . class A { public: int n; explicit A(int _n); }; A::A(int _n) { n = _n; } int main() { A a(3.3); // <== I expect this line to get an error. return 0; } 回答1: explicit class_name ( params ) (1)

Warning when comparing references to int and unsigned but no warning if comparing consts (no ref) with g++/msvc

杀马特。学长 韩版系。学妹 提交于 2019-12-12 03:18:41
问题 So I'm writing the doctest library and it's supposed to be warning free. I recently noticed that code that went into an if statement without warnings was causing trouble when written inside of my CHECK() macro. For example: if(0u == 0) doesn't cause a warning but CHECK(0u == 0); does. I investigated a bit and part of the reason is that behind the CHECK() macro there are templates and expression decomposition and capturing by const reference. My questions are 3: Given these 3 snippets - why

vector equals for type <std::string> works in g++ but not in visual studio 2010

大城市里の小女人 提交于 2019-12-12 03:18:01
问题 #include<iostream> #include<vector> std::vector<std::string> vector1; int main() { vector1.push_back("adadad"); std::vector<std::string> vector2; vector2.push_back("adadd"); if (vector1==vector2) { std::cout<<"success"; } else { vector1.swap(vector2); vector2.clear(); vector2.push_back("adadd"); if (vector1==vector2) { std::cout<<"success_swap"; } } } Now this works in g++ but not in visual studio. The operator == doesn't work here and throws compilation error in visual studio 2010(ultimate).

Windows Theano Keras - lazylinker_ext\mod.cpp: No such file or directory

こ雲淡風輕ζ 提交于 2019-12-12 03:15:03
问题 I am installing Theano and Keras follwing the How do I install Keras and Theano in Anaconda Python on Windows?, which worked fine for me with an older release before. Now I have upgraded to the latest Theano version and when validating its functionality using this command: Python: from theano import function, config, shared, sandbox it resulted in really long error log containing: g++.exe: error: C:\Users\John: No such file or directory g++.exe: error: Dow\AppData\Local\Theano\compiledir