Get the IP address of the machine

This Question is almost the same as the previously asked Get the IP Address of local computer-Question. However I need to find the IP address(es) of a Linux Machine. So: How do I -...

Detect 32-bit or 64-bit of Windows

I want to detect whether the current Windows OS is 32-bit or 64-bit. How to achieve it using C++? I don't want processor type I want OS's bit type. This is because you can install 32-bit OS on...

OS specific instructions in CMAKE: How to?

I am a beginner to CMAKE. Below is a simple cmake file which works well in mingw environment windows. The problem is clearly with target_link_libraries() function of CMAKE where I am linking...

QAction shortcut doesnt always work

I have a Qaction on a menu item for deleting selected items in one of my views. Here is how i create the action: deleteAct = new QAction( tr("Delete Selected"),...

get absolute value without using abs function nor if statement

I was thinking how to get the absolute value of an integer without using if statement nor abs(). At first I was using shift bits left (<<), trying to get negative sign out of the range, then shift...

Base class undefined

My code below generates the error 'WorldObject': [Base class undefined (translated from german)] Why is this? Here is the code which produces this error: ProjectilObject.h: #pragma once #ifndef...

unordered_map: which one is faster find() or count()?

What is the fastest way to figure out if an unordered_map container has an item with a specified key?

How do I input variables using cin without creating a new line?

Whenever I input a variable using cin, after one hits enter it automatically goes to a new line. I'm curious if there's a way to use cin without having it go to a new line. I'm wanting to cin and...

stl priority_queue of C++ with struct

How can we use STL priority_queue for struct ? Any illustration of pushing & popping , where struct has multiple data-types? Say : struct thing { int a; char b;} glass[10]; .Now how can i put...

C++ ifstream not reading \n?

I'm trying to do operations per-line of a text file, and the way I have it right now, my ifstream object isn't detecting the \n character for each line, which is required for this project. Here's...

extracting file inside of directory with miniz

Is there someone that can explain me how i can get files from directories inside a zipfile. I use c++ and miniz(code.google.com/p/miniz/). thank you in advance. here my code i have that i use...

I'm getting an error "invalid use of incomplete type 'class map'

I am making a basic text based RPG sorry if my question is stupid because im new to c++. So basically I have a small combat class that i have to link back and forth to from the map class so I had...

VS2013 with QT5.3.2 using Websocket and got a unresolved external symbol issue

I got a problem with VS2013 and QT5.3.2. when I am using Websocket, it says unresolved external symbol with QWebSocket::sendTextMessage and other websocket functions. I have already #include...

Removing the LF in codeblocks

How do i remove the LF at the end of each line in code blocks? Thanks in advance.

How do I set up scons to build a project that has generated source files?

I'm working on a C++ project that has some hand coded source files, as well as some source and header files that are generated by a command line tool. The actual source and header files generated...

OpenSSL 1.0.1f and "undefined reference to symbol '[email protected]@OPENSSL_1.0.0"

This morning I updated my OpenSSL version to the 1.0.1f, while compiling the project on which i am currently working i got this OpenSSL error from the linker: /usr/bin/ld: janus-dtls.o: undefined...

glad.h giving error that opengl header is included

I am trying to use glad.h with my code. I am programming on Visual Studio 2013. For some reason its giving me the error C1189: #error : OpenGL header already included, remove this include, glad...

undefined reference to `cv::VideoCapture::VideoCapture(int)

I'm having this problem when I'm trying to start my computer camera. I'm using this code #include "opencv2/highgui/highgui.hpp" #include <iostream> #include "opencv2/videoio.hpp" using namespace...

Importing a CMake project into CodeLIte

I was wondering if anyone knew of a way to import an existing cmake project into the CodeLite IDE? THis is a C++ project and I have all of the .c and .h files. I have the CMake lists and what not...

How to check if a number is prime in a more efficient manner?

So I have the following problem. They give me an array w/ n numbers and I have to print if it contains any prime numbers using "Divide et Impera". I solved the problem but it gets only 70/100...

Converting lines of code from C++ to JAVA

I have come up with the below code. Managed to resolve most of the errors except the one related to Map. I understand that the below line of code belongs to C++. Tried a lot to convert it to JAVA...

Would like to run PowerShell code from inside a C++ program

I want to be able to run like 30 lines of PowerShell script from my c++ program. I've heard it's a terrible idea, I don't care. I still would like to know how. I just want to code directly in the...

Setup C++ code example with sqlite3 not working

I try to setup sqlite3 extension in a basic c++ application. I know there are still threads on this site, but I have tried all suggestions for this problem. I cannot move on, nothing was the...

Why should I always enable compiler warnings?

I often hear that when compiling C and C++ programs I should "always enable compiler warnings". Why is this necessary? How do I do that? Sometimes I also hear that I should "treat warnings as...

Note when building CGAL code: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated

When I build the CGAL examples with cmake, I get this note: #pragma message: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. Please use...

How do I deal with an internal compiler error (cc1plus: gimplify) when installing c based python libraries (OpenCV2) on a Raspberry PI?

I've been trying to install the OpenCV2 libraries for Python 3 on my Raspberry PI 3B. I started this process by installing Python 3 through apt and using pip3 to install OpenCV. However the...

How to center an opengl window with glfw?

I wanna draw an opengl window in center of the screen,however I searched everywhere but didn't find any answer to it. Below is a common snippet code of creating a window But it always show up in...

Build error: make: Nothing to be done for 'compile'

I need to add my own package to the openwrt image. On the wiki of the project I found this article. I tried to follow the instructions for it, but in the end I did not manage to add my own package...

Compile-time C++ function to check whether all template argument types are unique

There is a nice question (https://stackoverflow.com/questions/59555623/which-substitution-failures-are-not-allowed-in-requires-clauses) proposing the next problem. One needs to write a...

Longest common prefix in binary representation

We are given a undirected tree with N (1 to N) nodes rooted at node 1. Every node has a value assigned with it, represented by array - A[i] where i:[1:N]. We need to answer Q queries of type :...

Relevant tags