g++

Crypto++ in Eclipse Undefined Reference

只谈情不闲聊 提交于 2021-01-28 21:07:16
问题 I'm trying to use Crypto++ for my Eclipse C++ project using the MinGW toolchain. Problem is, whenever I try to use crypto functions, I get flooded with "undefined reference" errors. Has anyone experienced this before? This is the what I'm getting (truncated): UPDATED g++ -L "C:\\Libraries\\crypto++\\Win32\\DLL_Output\\Debug" -lpthread -lcryptopp -o "Grum Net.exe" "src\\Vault\\VaultNode.o" "src\\User.o" "src\\Grum Net.o" src\Grum Net.o: In function `ZN8CryptoPP18HashTransformationD2Ev': C:

Replacement to getch based code block in cpp

只愿长相守 提交于 2021-01-28 19:52:42
问题 I stumbled upon a code from 2016 written in the Turbo C++ IDE in windows It was to accept passwords char pass; for (length = 0;;) { pass=getch(); if (pass == 13) { break; } if ((pass >= 'A' && pass <= 'Z') || (pass >= 'a' && pass <= 'z') || (pass >= '0' && pass <= '9') || (pass == '!' || '@' || '#' || '$' || '%' || '^' || '&' || '*' || '(' || ')')) { str[length] = pass; ++length; cout << "#"; } } is there any replacement for this without the getch method for linux to show output like this ***

glfw Errors with glfwWindowHint

点点圈 提交于 2021-01-28 14:09:12
问题 I have tried fallowing this tutorial and it did not work. I do not know why it is not working. I'm using Ubuntu 14.04 and GNU G++ command. code: #include <GLFW/glfw3.h> int main(void) { glfwInit(); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); glfwWindowHint(GLFW_RESIZABLE, GL_FALSE); GLFWwindow* window = glfwCreateWindow(800, 600,

mysql connector cpp in centos 6 undefined reference to

梦想与她 提交于 2021-01-28 11:52:02
问题 I already installed mysql cpp connector and Boost and also the g++ compiler. When I write a program that uses the mysql cpp connector it gives me the error: demo.cpp:(.text+0x3a): undefined reference to 'get_driver_instance' collect2: ld returned 1 exit status The command I'm using to build this code is: g++ demo.cpp -o demo My source code is : #include <stdlib.h> #include <iostream> #include "mysql_connection.h" #include <cppconn/driver.h> #include <cppconn/exception.h> #include <cppconn

How does the virtual inheritance table work in g++?

北战南征 提交于 2021-01-28 08:25:38
问题 I'm trying to get a better understanding how virtual inheritance works in practice (that is, not according to the standard, but in an actual implementation like g++ ). The actual question is at the bottom, in bold face. So, I built myself a inheritance graph, which has among other things, these simple types: struct A { unsigned a; unsigned long long u; A() : a(0xAAAAAAAA), u(0x1111111111111111ull) {} virtual ~A() {} }; struct B : virtual A { unsigned b; B() : b(0xBBBBBBBB) { a = 0xABABABAB; }

How to traverse a Btree?

浪尽此生 提交于 2021-01-28 06:27:17
问题 I have a Btree and I'm trying to figure out how traverse it so that the keys are displayed ascending order. All I can figure out is that this can be done with a recursive function. What's the pseudo-code to do it? 回答1: Assuming you have a definition like: template <class T> class btree_node { btree_node **child; // an array of child nodes T **element; // the elements in this node unsigned int child_count; // the number of children // the number of elements is 1 less then child_count }; Then

undefined reference to `pthread_cancel'

淺唱寂寞╮ 提交于 2021-01-28 03:22:03
问题 I have written the following T class with pthread . When i compile this class using g++ -lpthread then it's working fine. But if i extend this class from another class A and compile all together it's returns an error; "undefined reference to pthread_cancel" Code: class T{ private: pthread_t thread; public: void start(){ pthread_create(&thread,NULL,&run,this); } void destroy_thread(){ pthread_cancel(thread); } static void* run(void*){} ~Thread(){ destroy_thread(); } }; Next class: class A:T{ A

Installing g++ to terminal from files on my mac

我只是一个虾纸丫 提交于 2021-01-27 21:06:40
问题 When I try to compile a c++ program in my Mac terminal, I get the following error: -bash: g++: command not found but I believe I have all the files I need on my Mac to run the compiler. I have the Developer folder, which contains Xcode in Applications, g++ in the usr/bin folder, and a bunch of other folders. How can I use these files to install the g++ compiler. Thank you! 回答1: houbysoft's answer above is correct, but the OP needs a little more detail. The basic idea is that you need the

discards qualifiers

不羁的心 提交于 2021-01-27 19:10:45
问题 I am not really sure what my problem is. it says "discards qualifier". I don't know why this happens. if I erase const for overloaded operator += everything is fine. can someone help me out? // practice on overloading operators on Time variables #include <iostream> using namespace std; class Time { public: //constructor Time(const unsigned int& day = 0, const unsigned int& hour = 0, const unsigned int& minute = 0, const unsigned int& second = 0) : day_(day), hour_(hour), minute_(minute),

Can you pass your code directly into gcc? For example: gcc -? 'int main(){return 0;}'

≡放荡痞女 提交于 2021-01-27 18:54:19
问题 Can you pass your code directly into gcc? If so what is the command line option for it? For example: g++ -? 'int main(){return 0;}' I need to know because I am using a system command and I rather not make files: system("g++ -C "+code_string+" -o run.out"); Basile Starynkevitch solution worked, however I am getting compile errors when I use newlines: echo '#include\nint main(){printf("Hello World"); return 0;}' | g++ -x c++ -Wall -o myprog /dev/stdin Edit: fixed it echo -e '#include\nint main(