g++ undefined reference although symbol is present in *.so file

The pedantically correct way to check that a .so exports a symbol is nm –demangle –dynamic –defined-only –extern-only <lib.so> | grep <symbol>. Without –defined-only your command also shows undefined symbols. Without –extern-only it also shows symbols with internal linkage which are unavailable for linking. It looks like you need to link another library because Gps_Ephemeris::Gps_Ephermeris() … Read more

GCC: Difference between -O3 and -Os

The GCC documentation describes what these options do very explicitly. -O3 tries to optimize code very heavily for performance. It includes all of the optimizations -O2 includes, plus some more. -Os, on the other hand, instructs GCC to “optimize for size.” It enables all -O2 optimizations which do not increase the size of the executable, … Read more

How to use profile guided optimizations in g++?

-fprofile-generate will instrument the application with profiling code. The application will, while actually running, log certain events that could improve performance if this usage pattern was known at compile time. Branches, possibility for inlining, etc, can all be logged, but I’m not sure in detail how GCC implements this. After the program exits, it will … Read more

C++ undefined reference to defined function

The declaration and definition of insertLike are different In your header file: void insertLike(const char sentence[], const int lengthTo, const int length, const char writeTo[]); In your ‘function file’: void insertLike(const char sentence[], const int lengthTo, const int length,char writeTo[]); C++ allows function overloading, where you can have multiple functions/methods with the same name, as … Read more

Makefile removes object files for no reason

The files are being removed because make considers them “intermediate”. When make forms a chain of rules to produce a prerequisite, it treats all files created by the intermediate chains as “intermediate” and removes then when the target is created. See Chained Rules in the manual for GNU make. In your case, you can prevent … Read more

How do I build gcc with C++ concepts (“concepts lite”) support?

As of Fri, 7 Aug 2015 01:44:49 -0400 (05:44 +0000) concepts support has been merged into gcc’s trunk. Using a build from after that point, you can enable concepts support with the -std=c++1z flag. As of gcc 6.1 (27-04-2016), concepts are enabled by -fconcepts as they are unlikely to be included in C++17, so they … Read more

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