logo
down
shadow

CPP QUESTIONS

CFLAGS not working on Windows when compiling with node-gyp
CFLAGS not working on Windows when compiling with node-gyp
I wish did fix the issue. For some reason when I compile using node-gyp on Windows, CFLAGS are ignored. Does anyone maybe know the reason? This is my code: , Solved with:
TAG : cpp
Date : November 04 2020, 08:15 AM , By : Daniel
basic openmp program runs slower
basic openmp program runs slower
I wish this help you To be succesfull with your first OpenMP parallel (multi-threaded) code examples you need to improve your test cases from following two perspectives:
TAG : cpp
Date : November 04 2020, 08:15 AM , By : Krishna Sruthi
Consistency when removing items from boost multi-index using an inner iterator
Consistency when removing items from boost multi-index using an inner iterator
like below fixes the issue Your loop is likely fundamentally flawed. I think this is because you used confusing names (range0 etc.). You outer loop is unrelated to the inner loops so, you could have removed it (saving time doing useless repeats). Her
TAG : cpp
Date : November 04 2020, 08:15 AM , By : Kittirat Intarak
Can I Reference Previous Members of an Initializer List?
Can I Reference Previous Members of an Initializer List?
will be helpful for those in need So what we have here is aggregate initialization covered in section 8.5.1 of the draft C++ standard and it says:
TAG : cpp
Date : November 03 2020, 09:01 AM , By : Quan Nguyen
generate new type from container having same container type but different value_type
generate new type from container having same container type but different value_type
Does that help Given a container, for example a std::list or std::vector, I want to generate a new type std::list or std::vector respectively in a situation I do not know the container (std::list or std::vector) in advance. , Some template template p
TAG : cpp
Date : November 03 2020, 09:01 AM , By : Deesl
Undefined reference to QMediaPlayer and QVideoWidget
Undefined reference to QMediaPlayer and QVideoWidget
I think the issue was by ths following , Even though I declared QT += multimedia multimediawidgets in my .pro file I am getting error Undefined reference to QMediaPlayer and QVideoWidget constructors, destructors and methods, I included path in my .p
TAG : cpp
Date : November 03 2020, 09:01 AM , By : brs
Can't use a class reference as a non-type template parameter
Can't use a class reference as a non-type template parameter
I hope this helps you . You can't use local variables as parameters for template - type definition cannot be localized, it can be used outside local variable scope. But if you replace your template param to reference to global variable that would wor
TAG : cpp
Date : November 03 2020, 09:01 AM , By : Meagan Anne Hegler
Correct to place an #undef directive in C++ headers/implementation files
Correct to place an #undef directive in C++ headers/implementation files
wish helps you I do not see any reason to undef the macro. Surely you want all your code to be compiled with one state of that macro? Then you will not need to undef it.However, I also strongly suggest you to use typedef for your string definition. T
TAG : cpp
Date : November 02 2020, 09:01 AM , By : Essam Zaroura
Corner and edge detection in a graph
Corner and edge detection in a graph
Hope that helps So.. I finally managed to solve my problem, by rewriting it.. The new version work in a different way, and seem a bit more structured for the human eye, but slower compared the one posted above.
TAG : cpp
Date : November 02 2020, 09:01 AM , By : taylory5
Self-contained shared library
Self-contained shared library
it helps some times You can use the -static-libstdc++ option to link libstdc++ statically. You probably shouldn't link statically to libc (or libgcc, which you can link statically with -static-libgcc should you need to) if you're making a dynamic lib
TAG : cpp
Date : November 02 2020, 09:01 AM , By : N1ghtFeather
Delete array pointer c++ when increase pointer?
Delete array pointer c++ when increase pointer?
With these it helps Neither; it's undefined behaviour, which usually means it'll crash the program.The pointer you pass to delete[] must be one that was previously returned from new[]. No exceptions*. new[] returned a pointer to the first element of
TAG : cpp
Date : November 02 2020, 09:01 AM , By : Atithi Atmo
Which operator is faster: != or >
Which operator is faster: != or >
Does that help The question seems to be non-sense.Don't optimize prematurely, focus first on making code as clear and readable as possible, based on the specification or real situation. For the other programmers, if(time > -1) and if(time != -1) coul
TAG : cpp
Date : November 02 2020, 09:01 AM , By : Gary Dupper
My Binary Search Algorithm Template Function is Always Returning False
My Binary Search Algorithm Template Function is Always Returning False
Hope that helps So I'm supposed to use the Binary Search template function to read elements from a file to an array and then allow the user to search for an element if it's in the array. The problem is that whenever I search for a number, it gives me
TAG : cpp
Date : November 01 2020, 04:09 PM , By : emine nur cinci
MFC redirect/catching MESSAGE_MAP | PreTranslateMessage?
MFC redirect/catching MESSAGE_MAP | PreTranslateMessage?
Any of those help The problem is that the tree view will send all its notifications to the parent window. And the parent windows is the CHolderWindow.Messages are not routed like WM_COMMAND messages. So handler for WM_COMMAND messages may reside anyw
TAG : cpp
Date : November 01 2020, 04:09 PM , By : Jafar Aftabi
Object scope and lifetime in a for loop
Object scope and lifetime in a for loop
I wish did fix the issue. Constructor and destructor are called 5 times, right.Because control flow crosses 5 times the initialization of cat, and 5 times the end of its scope (the closing '}' of loop block).
TAG : cpp
Date : November 01 2020, 04:09 PM , By : Dasari Prabhakar
C++ delete map of pointers: free() invalid size
C++ delete map of pointers: free() invalid size
I think the issue was by ths following , Your code is fine, you can test it here: http://coliru.stacked-crooked.com/a/ef44f698821c9851but you probably are doing something else in the middle, most probably double deleting those pointers - what causes
TAG : cpp
Date : November 01 2020, 04:09 PM , By : serge
boost mpz_int with base other than 2, 8, 10, 16
boost mpz_int with base other than 2, 8, 10, 16
wish of those help I can create multi precision integers from a string with standard base , Yes.
TAG : cpp
Date : November 01 2020, 04:09 PM , By : Sina Awofala
How to catch all custom exceptions in a single catch statement with Apache Thrift?
How to catch all custom exceptions in a single catch statement with Apache Thrift?
this will help Albeit this does not really answer the question literally (@Simple did a good job at this already) I would like to propose a somewhat different approach. Given the code posted above:
TAG : cpp
Date : November 01 2020, 04:09 PM , By : Vinay Agrawal
C++ 11 lambda callback in VS 2013 won't compile
C++ 11 lambda callback in VS 2013 won't compile
hope this fix your issue The error message doesn't seem to match the code: the last argument is a std::function const not a std::function as stated in the error. Does your actual code declare the std::function parameter as const?
TAG : cpp
Date : November 01 2020, 04:09 PM , By : Liam Mahoney
opencv euclidean clustering vs findContours
opencv euclidean clustering vs findContours
wish of those help You can use partition for this:partition splits an element set into equivalency classes. You can define your equivalence class as all points within a given euclidean distance (radius tolerance)
TAG : cpp
Date : November 01 2020, 04:09 PM , By : Marco
Why is iterating through nodes in linked list not an assignment in C++?
Why is iterating through nodes in linked list not an assignment in C++?
I hope this helps you . You need to look at what you are actually assigning to.You have a local variable current. Changing that to point to different nodes doesn't modify the nodes itself. It's like you have a bit of paper with different house addres
TAG : cpp
Date : November 01 2020, 04:09 PM , By : Chris Kirton
Can we implement a doubly-linked list using a single pointer?
Can we implement a doubly-linked list using a single pointer?
I hope this helps you . Yes, it's possible, but it's a dirty hack.It's called XOR linked list. (https://en.wikipedia.org/wiki/XOR_linked_list)
TAG : cpp
Date : November 01 2020, 04:09 PM , By : May Lik
Cast from unsigned long long to double and vice versa changes the value
Cast from unsigned long long to double and vice versa changes the value
will help you 18446744073709551615 is not exactly representible in double (in IEEE754). This is not unexpected, as a 64-bit floating point obviously cannot represent all integers that are representible in 64 bits.According to the C++ Standard, it is
TAG : cpp
Date : November 01 2020, 04:09 PM , By : Drewww R
Why am I getting memory errors when accessing this matrix in OpenCV?
Why am I getting memory errors when accessing this matrix in OpenCV?
I hope this helps . You seem to have the dimensions of your matrix mixed up. You construct a matrix with 59 columns and 9 rows, and access the 10th row and 4th column:
TAG : cpp
Date : November 01 2020, 04:09 PM , By : Alex Malik
std::condition_variable wait() and notify_one() synchronization
std::condition_variable wait() and notify_one() synchronization
Hope this helps Even with unique_lock in consumer thread there is a possibility that producer thread will run first, lock the mutex and call noify() before consumer calls wait(), therefore, my app will be missing first nofity() call.
TAG : cpp
Date : November 01 2020, 03:09 PM , By : Daniel Biedma Ramos
error C2514 class has no constructors. But it does?
error C2514 class has no constructors. But it does?
should help you out It can be that you only forward-declared ListOfEmployeeNode, without including it's header (and therefore definition) where it is used.In that case, the compiler knows about the class, but cannot access any members, including cons
TAG : cpp
Date : November 01 2020, 03:09 PM , By : Erika Wagoner
I'm having problems with my linkedlist method
I'm having problems with my linkedlist method
wish help you to fix your issue I can't add comment for now so i'm answer, take it like comment.the void enqueue(edge component) really is no problem with it but i think you'r problem in void insert(edge e) with insert(createKey(e), e); especially cr
TAG : cpp
Date : November 01 2020, 03:09 PM , By : wsong
use of extern keyword with CHandle for win32 events
use of extern keyword with CHandle for win32 events
will be helpful for those in need In main.cpp you define a HANDLE hEvent, in ThreadProcedure.cpp you declare an extern CHandle hEvent. Surely those are not identical. So the linker is right, he does not find any CHandle hEvent, only a HANDLE hEvent.
TAG : cpp
Date : November 01 2020, 03:09 PM , By : James Pemberton
Pointer to a cell matrix c++
Pointer to a cell matrix c++
I wish this help you Check your types - it wouldn't work with int x; float *p = x; either.You need either float[10][10] or int* p.
TAG : cpp
Date : November 01 2020, 03:09 PM , By : mark
Only whitespaces in string find_first_not_of() vs find_last_not_of()
Only whitespaces in string find_first_not_of() vs find_last_not_of()
Hope that helps The way std::basic_string::find_last_not_of is implemented is not part of the specification; thus we can't say if the characters are looked up in natural or reversed order.Hence,
TAG : cpp
Date : November 01 2020, 03:09 PM , By : SpaCityJay
Need to sort list of names, how do I overload and define bool operator <?
Need to sort list of names, how do I overload and define bool operator <?
wish help you to fix your issue So the teacher built the main and a prototype for a class that builds and modifies a phone book. Right now I'm barely defining the class functions, but ran into trouble defining one of his prototypes bool operator
TAG : cpp
Date : November 01 2020, 01:05 PM , By : Valery Sizov
Why Boost:Format and printf behave differently on same format string
Why Boost:Format and printf behave differently on same format string
I wish did fix the issue. This is expected behaviour.In the boost manual it is written about the classical type-specification you uses:
TAG : cpp
Date : November 01 2020, 01:05 PM , By : Jared Phifer
How to get the number of bytes actually occupied by a string in memory?
How to get the number of bytes actually occupied by a string in memory?
this will help Since s.data() points to the first character of the string, you can check whether that address lies within the string object itself.Make sure to use equality-comparison only, since pointers to objects that are not subobjects of the sam
TAG : cpp
Date : November 01 2020, 01:05 PM , By : Munna Ð Ðavíl
C++ math expression from math formula
C++ math expression from math formula
Hope that helps First, the log function already computes the logarithm to the base e. You don't need to perform any change-of-base.Second, split your expression into parts to make it easier to write, and to understand:
TAG : cpp
Date : November 01 2020, 01:05 PM , By : Rick G
specify default value of std::function
specify default value of std::function
will help you
TAG : cpp
Date : November 01 2020, 01:05 PM , By : Nicholas Lorenzini
Improving the Performance for inserting elements into Linked List from an Array
Improving the Performance for inserting elements into Linked List from an Array
like below fixes the issue You're now looking for the last node every time you insert a new node... but you would already know where the last node is because you just inserted it in the last iteration - if only you hadn't thrown that information away
TAG : cpp
Date : November 01 2020, 01:03 PM , By : Kaspars Bankovskis
Why location 0x00000000 is accessible if it is a flash memory
Why location 0x00000000 is accessible if it is a flash memory
I think the issue was by ths following , The decision as to what happens when using what address is rather complex. It depends on the processor architecture, OS and sometimes "what some software does".The processor may not have memory protection, or
TAG : cpp
Date : November 01 2020, 01:03 PM , By : 欧阳安
Is it possible to connect to QApplication notify signal?
Is it possible to connect to QApplication notify signal?
fixed the issue. Will look into that further Maybe you should have a look at event filters, which you can install for all QObjects: QObject::installEventFilter. Write your own class, which you inherit from QObject and implement the eventFilter method
TAG : cpp
Date : November 01 2020, 01:03 PM , By : Shajahan Sha
An std::move function of C++ standard 11 implementation in C
An std::move function of C++ standard 11 implementation in C
I wish did fix the issue. We are all aware of the powerful functionality of the std::move function that is implemented in the C++ standard 11, where it moves the elements in a specific range into a new range. , Regarding your text:
TAG : cpp
Date : November 01 2020, 01:03 PM , By : Gal Avidor
segmentation of the source image in opencv based on canny edge outline attained from processing the said source image
segmentation of the source image in opencv based on canny edge outline attained from processing the said source image
This might help you Use cv::findContours on your second image to find the contour of the segment. Then use cv::boundingRect to find bounding box for this segment. After that you can create matrix and save in it cropped bounding box from your second i
TAG : cpp
Date : November 01 2020, 09:01 AM , By : Gaurav Bhelaye
C++ Linked List Node Creation Causing Infinite Loop
C++ Linked List Node Creation Causing Infinite Loop
With these it helps You should be allocating space when creating your newNode (which should be a pointer to node for the matter).Remember, the model of double linked linear list should be connecting your node to the list (Which you are pointing to) a
TAG : cpp
Date : November 01 2020, 09:01 AM , By : Dino Penava
boost: replace basic classes to std one?
boost: replace basic classes to std one?
should help you out Some libraries use c++11 classes automatically when detected. It depends on the library author.There is no such general compilation flag you can use.
TAG : cpp
Date : November 01 2020, 09:01 AM , By : hugo
How can I account for a decimal using the modulus operator
How can I account for a decimal using the modulus operator
I think the issue was by ths following , The quotient is 0(2/6) with the fractional part discarded.The fractional part is .3333 ... So you are basically talking about the fractional part of the quotient , not the modulus value. Modulus can be calcula
TAG : cpp
Date : November 01 2020, 09:01 AM , By : Neil Ault
c++ pointer being freed was not allocated error
c++ pointer being freed was not allocated error
help you fix your problem The nextStudent field is never initialized, so all 10 elements created here have it pointing to unknown values.
TAG : cpp
Date : November 01 2020, 09:01 AM , By : João Fauvel
Undefined Reference when Invoking Function of One Object from Another Object
Undefined Reference when Invoking Function of One Object from Another Object
I hope this helps . Figured it out:1) You can make a makefile; I use PuTTY to accomplish this for example.
TAG : cpp
Date : November 01 2020, 09:01 AM , By : Jay
Weird issue with signals in QML
Weird issue with signals in QML
To fix this issue There is no issue. You can read about it here: http://doc.qt.io/qt-5/qtqml-syntax-objectattributes.htmlproperty-attributes
TAG : cpp
Date : November 01 2020, 09:01 AM , By : Dilan Patel
Why is the copy constructor called in this code after the assignment operator?
Why is the copy constructor called in this code after the assignment operator?
may help you . Because if you don't return a reference of the object it makes a copy. As @M.M said about the final test() call, the copy does not appears because of the copy elision What are copy elision and return value optimization?
TAG : cpp
Date : October 31 2020, 05:43 PM , By : Santihago
Push back Data into Matrix and show that matrix using imshow
Push back Data into Matrix and show that matrix using imshow
will help you as far as I see, `mat.push_back will add another ROW to your matrix. So you create a 10000x20 matrix and you try to add another single element as a new row. That doesn't work because your rows have 20 columns and not just 1 column. So t
TAG : cpp
Date : October 31 2020, 05:43 PM , By : Djura
Different way to initialize
Different way to initialize
Hope that helps Here's the correct way to do this:You define your attributes in a class/struct, and when that struct is initialized, the constructor(OrcishAttributes()) is called:
TAG : cpp
Date : October 31 2020, 05:43 PM , By : Федор Поправкин
Two column TPopupMenu to list shortcuts right aligned
Two column TPopupMenu to list shortcuts right aligned
it should still fix some issue A menu item can have an image (see the TMenuItem.ImageIndex property), and can have a shortcut assigned (see the TMenuItem.ShortCut property). The VCL will automatically draw those elements for you, exactly as you have
TAG : cpp
Date : October 31 2020, 05:43 PM , By : MarkT
Read file fail when call C++ function in Swift code
Read file fail when call C++ function in Swift code
I wish this help you As you said, the code in the question is a simple example. I don't think the problem you are asking about, namely the fact that "FAIL" is output, is related to the real difficulties of bridging between C++ and Swift. The C++ func
TAG : cpp
Date : October 31 2020, 05:43 PM , By : kuniatsu
c++ std::move is bad here?
c++ std::move is bad here?
I hope this helps . It's redundant and confusing. Just because I can write std::add_pointer_t instead of void*, or std::add_lvalue_reference_t (or Foo bitand) instead of Foo, doesn't mean I should.It also matters in other contexts:
TAG : cpp
Date : October 31 2020, 05:41 PM , By : Andrew Yi
Segmentation Fault with Libvlc on Mac OSX
Segmentation Fault with Libvlc on Mac OSX
To fix the issue you can do If you use libvlc v2.2 - you have to use slightly modified libvlc tree (I have one prepared, please extract it from command line, to preserve symlinks)The problem is libvlc v2.2 has a bug which leads to load libvlccore by
TAG : cpp
Date : October 31 2020, 05:41 PM , By : andal_claim
error_complexity using std regex, how do I increase allowed complexity of search operation?
error_complexity using std regex, how do I increase allowed complexity of search operation?
I think the issue was by ths following , There is no way, VC++ std::regex is very bad. Switched to boost, fixed problem.
TAG : cpp
Date : October 31 2020, 05:41 PM , By : Anup Tiwari
moving variable declarations outside for loop
moving variable declarations outside for loop
To fix this issue You did not move all the variables. pos and b are still defined inside the loop, hiding the outside definitions (and the outer pos became a vector for some reason). The outer variables are untouched inside the loop, hence are not in
TAG : cpp
Date : October 31 2020, 05:41 PM , By : Amit Shah
Unhandled exception after reading from a binary file, when control is returned to calling function
Unhandled exception after reading from a binary file, when control is returned to calling function
Hope that helps I created a struct to hold the data being read to the file, then converted all strings to char arrays. Doing each of those did not work, but the combination did. The following is the test program with a main() and a test class (with a
TAG : cpp
Date : October 31 2020, 05:41 PM , By : Prakash Raushan
How make a dynamic array using void** and void*?
How make a dynamic array using void** and void*?
To fix the issue you can do Using a double pointer for a data type such as int** with give you a dynamic 2D array, or a dynamic array of pointer objects, depending on your implementation, and a single int* is just a normal dynamic array. To full inst
TAG : cpp
Date : October 31 2020, 05:41 PM , By : Phan Nguyễn Minh Văn
C++ nested loop issue
C++ nested loop issue
help you fix your problem Ok, this is pretty bizarre... I'm working on my final project for this class, and it has a series of loops that tell the program what to do based on user input. They worked just fine. I then coded another loop inside one of
TAG : cpp
Date : October 31 2020, 05:41 PM , By : Keerthana Dabbara
How can I access the members of a struct in a loop?
How can I access the members of a struct in a loop?
around this issue Yes, it's possible. Initialize an array of pointer offsets using offsetof. Then add that to reinterpret_cast(struct_var), cast that to the target type, and there you go...you have a pointer to the member and you can iterate them in
TAG : cpp
Date : October 31 2020, 05:41 PM , By : lunar
reversing non-zero-initialized chars in array
reversing non-zero-initialized chars in array
seems to work fine Cheers guys - here's what I ended up coming up with. Seems like it works.
TAG : cpp
Date : October 31 2020, 05:41 PM , By : Rama M

shadow
Privacy Policy - Terms - Contact Us © animezone.co