Linked Questions
13 questions linked to/from Force GCC to notify about undefined references in shared libraries
0
votes
1
answer
81
views
g++ doesn't show expected linker errors [duplicate]
I'm new to linux development, but have many years experience in Windows development. I'm trying to link a program using:
g++ -fPIC -shared $(OBJ_FILES) -o libMyLib.so
The odd thing is, this works. ...
1
vote
0
answers
51
views
Is it possible to force linker errors in gcc/g++? [duplicate]
Consider the next C/C++ code:
//Main.c
#include <stdio.h>
#include "mkl_cblas.h"
int tfuuuuuuuuuuuuuu()
{
int Num = 10;
double A[30] = {0.0};
double B[30] = {0.0};
double C[9];
...
7
votes
1
answer
7k
views
Undefined symbol using Boost/Python
Using Boost 1.63.0, I've coded up the following:
vectors.cpp
/* Boost/Python headers */
#include<boost/python/module.hpp>
#include<boost/python/def.hpp>
#include<boost/python/extract....
3
votes
2
answers
815
views
C++ compiles and links with pointer to undefined function
This code:
void undefined_fcn();
void defined_fcn() {}
struct api_t {
void (*first)();
void (*second)();
};
api_t api = {undefined_fcn, defined_fcn};
defines a global variable api with a ...
2
votes
1
answer
2k
views
How to make linker fail for undefined references when building shared library in Linux
I'm trying to build a shared library in C++ in Ubuntu (which I will load at runtime using dlopen), but I noticed that the shared library builds just fine even if there's some missing dependencies. If ...
0
votes
1
answer
2k
views
Which version of `gcc` supports the `--no-undefined` switch?
I am trying to compile pynifti package from source (long story involving Anaconda Python distribution).
After running make, I receive the following error:
gcc: error: unrecognized command line ...
0
votes
0
answers
2k
views
How to check if a shared object library provides all references for a header file?
How can I let GCC check if a shared object library provides definitions to all functions that have been declared in a header file? Given the example below, how can I verify during compilation steps ...
0
votes
1
answer
1k
views
Unable to load shared object: undefined symbol
I'm trying to create simple lib for the R with statically linked boost.
CMakeLists.txt
cmake_minimum_required(VERSION 3.3)
project(TheRPath)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall ...
-1
votes
1
answer
1k
views
How to compile QCustomPlot for OSX?
I am usually working on Ubuntu, using CMake and native environment. My project compiles and runs fine. Now I changed to OSX and first of all I receive some warnings when compiling QCustomPlot:
...
-2
votes
3
answers
538
views
Implementing Factory Pattern in C++
I'm basically having header issues.
#include "Base.h"
class Factory
{
public:
static Base generateReply(int input);
};
And then the factory cxx file
#include "derived1.h"
#include "...
2
votes
1
answer
312
views
G++ lets me call undefined methods
I have a large Qt project under Ubuntu. Just found that G++ lets me compile AND link code where I'm calling an declared but undefined method. It crashes at runtime at that call.
I couldn't reproduce ...
0
votes
0
answers
76
views
Load Multiple Library in C program [duplicate]
I dont know if this is a bad question, but I am having some problem of an undefined symbol when my program is run.
I have more than 20 dynamic libraries,
When I run my program that loads my library
...
2
votes
1
answer
58
views
Why the sequence of the parameters passes to the `gcc` influence the output of `readelf -d` for the built shared library?
Given these:
bar.cpp:
int foo();
int bar()
{
return foo();
}
foo.cpp:
int foo()
{
return 42;
}
The libfoo.so is built by gcc for foo.cpp,i.e. gcc -shared -o libfoo.so -fPIC foo.c
As it's ...