How do I include a path to libraries in g++

To specify a directory to search for (binary) libraries, you just use -L: To specify the actual library name, you use -l: To specify a directory to search for include files (different from libraries!) you use -I: So I think what you want is something like These compiler flags (amongst others) can also be found at the GNU GCC Command … Read more

Undefined reference to class constructor, including .cpp file fixes

The undefined reference error indicates that the definition of a function/method (i.e constructor here) was not found by the linker. And the reason that adding the following line: fixes the issue, is it brings in the implementation as part of the main.cpp whereas your actual implementation is in StaticObject.cpp. This is an incorrect way to fix this problem. I haven’t used Netbeans … Read more

I get this error: “glibc detected”

Even if you’re not allocating memory directly, it happens under the hood in vector code and you most likely corrupted some portion of memory by writing where you are not supposed to. The most likely reasons I can think of are: Writing to an element that is out of bounds Using a pointer/reference to an element that … Read more

Error: free(): invalid next size (fast):

It means that you have a memory error. You may be trying to free a pointer that wasn’t allocated by malloc (or delete an object that wasn’t created by new) or you may be trying to free/delete such an object more than once. You may be overflowing a buffer or otherwise writing to memory to which you shouldn’t be writing, causing heap corruption. Any … Read more