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

To specify a directory to search for (binary) libraries, you just use -L: -L/data[…]/lib To specify the actual library name, you use -l: -lfoo # (links libfoo.a or libfoo.so) To specify a directory to search for include files (different from libraries!) you use -I: -I/data[…]/lib So I think what you want is something like g++ … Read more

What is a .h.gch file?

A .gch file is a precompiled header. If a .gch is not found then the normal header files will be used. However, if your project is set to generate pre-compiled headers it will make them if they don’t exist and use them in the next build. Sometimes the *.h.gch will get corrupted or contain outdated … Read more

extra qualification error in C++

This is because you have the following code: class JSONDeserializer { Value JSONDeserializer::ParseValue(TDR type, const json_string& valueString); }; This is not valid C++ but Visual Studio seems to accept it. You need to change it to the following code to be able to compile it with a standard compliant compiler (gcc is more compliant to … Read more

How does #include work in C++? [duplicate]

It is basically a header file that also includes every standard library and STL include file. The only purpose I can see for it would be for testing and education. Se e.g. GCC 4.8.0 /bits/stdc++.h source. Using it would include a lot of unnecessary stuff and increases compilation time. Edit: As Neil says, it’s an … Read more

error: use of deleted function

The error message clearly says that the default constructor has been deleted implicitly. It even says why: the class contains a non-static, const variable, which would not be initialized by the default ctor. class X { const int x; }; Since X::x is const, it must be initialized — but a default ctor wouldn’t normally … Read more

Why does flowing off the end of a non-void function without returning a value not produce a compiler error?

C99 and C++ standards require non-void functions to return a value, except main. The missing return statement in main will be defined (to return 0). In C++ it’s undefined behaviour if execution actually reaches the end of a non-void function other than main, while in C it’s only UB if the caller uses the return … Read more

std::enable_if to conditionally compile a member function

SFINAE only works if substitution in argument deduction of a template argument makes the construct ill-formed. There is no such substitution. I thought of that too and tried to use std::is_same< T, int >::value and ! std::is_same< T, int >::value which gives the same result. That’s because when the class template is instantiated (which happens … Read more

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