How to determine what C++ standard is the default for a C++ compiler?

What about compiling and executing the following trivial program ? #include <iostream> int main() { std::cout << __cplusplus << std::endl; } The value printed should say the version used: 199711 for C++98, 201103 for C++11 201402 for C++14 201703 for C++17 If you compile omitting the -std=c++xx flag, you should be able to detect the … Read more

How does GCC’s ‘-pg’ flag work in relation to profilers?

Compiling with -pg instruments your code, so that Gprof reports detailed information. See gprof’s manual, 9.1 Implementation of Profiling: Profiling works by changing how every function in your program is compiled so that when it is called, it will stash away some information about where it was called from. From this, the profiler can figure … Read more

Can I use shared library created in C++ in a C program?

You want something more like this (and here I will use a slightly more meaningful example): C/C++ header – animal.h #ifndef ANIMAL_H #define ANIMAL_H #ifdef __cplusplus class Animal { public: Animal() : age(0), height(0) {} Animal(int age, float height) : age(age), height(height) {} virtual ~Animal() {} int getAge(); void setAge(int new_age); float getHeight(); void setHeight(float … Read more

Why does Delphi’s compilation speed degrade the longer it’s open, and what can I do about it?

If you build your application, here are some tricks to speed up the process: Erase all *.dcu before the build (del *.dcu /s); Run a good defragmenter on your corresponding hard drive; Put most of your source files in the same directory, and try to leave the IDE and Project library paths as short as … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)