Compiling with Clang using Libc++ undefined references
I believe libc++ doesn’t support all exception functions yet. See the status page: http://libcxxabi.llvm.org/spec.html You could probably link against gnu’s libstdc++
I believe libc++ doesn’t support all exception functions yet. See the status page: http://libcxxabi.llvm.org/spec.html You could probably link against gnu’s libstdc++
Usually headers guards are for header files (i.e., .h ) not for source files ( i.e., .cpp ). Include the necessary standard headers and namespaces in source files. LinearNode.h: #ifndef LINEARNODE_H #define LINEARNODE_H class LinearNode { // ….. }; #endif LinearNode.cpp: #include “LinearNode.h” #include <iostream> using namespace std; // And now the definitions LinkedList.h: #ifndef … Read more
You’ve declared the destructor, but not defined it. Change the declaration to: virtual ~Force() {} to define it to do nothing. You also want to make all the functions in the abstract interface pure virtual, otherwise they will need to be defined too: virtual VECTOR eval(VECTOR x, double t) = 0;
libgurobi_c++.a was compiled with -fno-stack-protector (obviously). A few things come to mind: add -fstack-protector when linking. This will make sure that libssp gets linked. Manually link -lssp Make your dummy version of __stack_chk_fail(void) in it’s own object file and and add this .o file to your linker command AFTER libgurobi_c++.a. GCC/G++ resolves symbols from left … Read more
gcc main.c hello_world.c -o main Also, always use header guards: #ifndef HELLO_WORLD_H #define HELLO_WORLD_H /* header file contents go here */ #endif /* HELLO_WORLD_H */
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
Try adding -nostartfiles to your linker options, i.e. $(LINK) -nostartfiles -g … From the gcc documentation: -nostartfiles Do not use the standard system startup files when linking. The standard system libraries are used normally, unless -nostdlib or -nodefaultlibs is used. This causes crt1.o not to be linked (it’s normally linked by default) – normally only … Read more
If Obstacle is an abstract base class, then make sure you declare all its virtual methods “pure virtual”: virtual void Method() = 0; The = 0 tells the compiler that this method must be overridden by a derived class, and might not have its own implementation. If the class contains any non-pure virtual functions, then … Read more
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
Try this approach: Compile the code for which you want to generate the coverage with these options: CFLAGS: -fprofile-arcs -ftest-coverage LFLAGS: -lgcov –coverage If this doesn’t solve the problem, then please provide some information on the structure of your application, i.e. whether its single program or an application involving shared/static libraries etc.