Questions tagged [undefined-reference]

A linker error caused by a missing definition of a symbol used elsewhere in a program

Filter by
Sorted by
Tagged with
-1 votes
0 answers
19 views

The function is not visible in a separate file [duplicate]

I put the getRand() function in a separate file, but when compiling I get an error: ...undefined reference to `getRand()' main.cpp: #include "library.h" #include <iostream> int main() {...
emblox's user avatar
  • 35
-2 votes
0 answers
50 views

Linker can't find __throw_bad_array_new_length?

I tried to run simple program in c++ which includes SFML/Graphics.hpp I try: g++ sfml.cpp -o mySFMLApp -lsfml-graphics -lsfml-window -lsfml-system using g++ (GCC) 10.3.1 on Ubuntu 22.04.3 LTS and ...
Jakub's user avatar
  • 1
0 votes
1 answer
44 views

Why do I get an undefined reference to a symbol that is defined in the library I am linking?

I was trying to compile an unrelated project when I got an undefined reference when using a specific function of the Raylib library. I was able to reproduce this behaviour using the following test.c #...
Alaric de Ruiter's user avatar
0 votes
0 answers
44 views

OpenCV undefined reference to `cv::cvtColor while building with CMake

I am building a basic edge detector with OpenCV. I can compile it with g++ and results are also as expected. But I need to build this using CMake and for the below mentioned CMakeListst.txt I am ...
TimothyHeadhunter's user avatar
0 votes
1 answer
64 views

undefined reference to `cuMemAlloc_v2'

I need to modify linux rdma-core driver and add some cuda-related functions; firstly, cuMemAlloc. I have changed the CMake file in the driver to include the cuda.h header file. But when I compile the ...
Nurlan Nazaraliyev's user avatar
0 votes
0 answers
42 views

"undefined reference to symbol" with SDL?

I am using c, sdl2 and raycasting to create a maze from a 2d array: // input.c #include <SDL2/SDL.h> #include "main.h" #include <stdlib.h> void move(double dirX, double dirY, ...
Ornelle's user avatar
0 votes
0 answers
37 views

Linker errors with BLAS/LAPACK symbols (snrm2_, sdot_, etc) when building Fortran project with gfortran on Windows

I'm trying to build the Elmer finite element software (version 9.0) using gfortran 10.2.0 and OpenBLAS 0.3.15 libraries on Windows 10. I'm running into linker errors when creating the shared libraries,...
Foad S. Farimani's user avatar
0 votes
0 answers
19 views

Using the icu library, an undefined reference to 'uregex_groupCount_48' appears when compiling with make

icu version : 4.8.1 use autoconf and automake to compile Use dynamic library:LDFLAGS= -licui18n -licuuc -licudata add header files:-I${ICU_ROOT}/unicode/include ${ICU_ROOT} is the file path where I ...
long yang's user avatar
0 votes
0 answers
45 views

CMake: Issue with finding the right header files for suitesparse library with find_package() and find_path()

I am relatively new to cmake. I'm on Ubuntu 20.04, and I'm encountering an issue where I'm trying to build the project dpgo from this repository: https://github.com/mit-acl/dpgo. From the repository, ...
User_0603's user avatar
0 votes
2 answers
65 views

How to link libraries in Qt project?

I'm trying to add parts of directshow example from libirimager library to my own Qt project. I can't link IRImager class. It has only header IRImager.h in sdk directory. In my main.cpp I just added ...
a.wise's user avatar
  • 164
2 votes
1 answer
107 views

Undefined reference to function, but it's all defined

I have problems with running multiple files after creating a library, which in this case I called "calcola.h". It seems all right to me, but the error "undefined error somma, error: ld ...
Andrea Sestito's user avatar
0 votes
1 answer
18 views

Undefined Reference when Using Crypto++ in Qt Creator

I am trying to use crypto++ on windows in my Qt Creator project. I am using qmake, so I have a .pro file and have included the following lines: INCLUDEPATH += "C:\Users\username\Downloads\...
Ryan's user avatar
  • 1
0 votes
1 answer
87 views

What's the difference between these two definitions of a virtual function? [duplicate]

I was getting an error in something called TouchGFX and it was pointed out to me that a virtual function inside a class needed to be defined with curly braces vs just a semicolon at the end of its ...
Rodo's user avatar
  • 115
0 votes
1 answer
160 views

How to properly build & link the libunwind library

I need to build the libary libunwind(https://github.com/libunwind/libunwind) on my ubuntu x86_64 pc for my pc and compile and link everything with g++. I am able to build some files, including the ...
DSKY's user avatar
  • 1
0 votes
1 answer
24 views

undefined reference to `readIntInRange` when compilling project with two static libraries where one library is used in the other

I have a C project that has this structure: The main.c has this at the top of the file: #include "libbattleship/libbattleship.h" int main() { ... So I include the headers in ...
Aleix Mariné's user avatar
0 votes
0 answers
12 views

undefined reference to `boost::timer' libraries while building OpenMPL project [duplicate]

I am trying to build OpenMPL project. However some errors happens with the boost library [ 99%] Linking CXX executable OpenMPL CMakeFiles/OpenMPL.dir/main.cpp.o: In function `main': main.cpp:(.text....
Molybdenum's user avatar
0 votes
0 answers
81 views

GCC cross compiling - undefined reference to `__strtof_nan@GLIBC_PRIVATE'

I'm cross-compiling a project using arm-linux-gnueabi-gcc on Ubuntu using make. Linker issues the following error: /usr/lib/gcc-cross/arm-linux-gnueabi/11/../../../../arm-linux-gnueabi/bin/ld: /usr/...
Yousef Rashidi's user avatar
0 votes
1 answer
201 views

PCL undefined reference in linker

I am trying to use SurfaceReconstruction from point cloud data, here is my code #include <pcl/point_types.h> #include <pcl/io/pcd_io.h> #include <pcl/io/ply_io.h> #include <pcl/...
bipin krishna's user avatar
1 vote
1 answer
46 views

"undefined reference to `main' /tmp/ccTJnyB3.o: In function `insertBack': crawler.c:(.text+0xf3): undefined reference to `indexPage" C Crawler Program

I keep getting these errors when trying to compile crawler.c file and indexPage.c file. I'm going to add everything so you can see. [salisn02@diamond code]$ gcc -o crawler -Wall crawler.c /usr/lib/gcc/...
sallysal's user avatar
0 votes
0 answers
257 views

CMake Compilation Error with Protobuf Library: undefined reference to `google::protobuf::Message::GetTypeName() const'

I am attempting to compile a project using CMake that utilizes both the Protobuf and Open3D libraries. However, during the compilation process, I am encountering the following error: ➜ build git:(dev)...
Cassius0924's user avatar
0 votes
0 answers
190 views

Error while build with cmake: undefined reference to `__imp__dupenv_s'

I'm trying to download and use a library (matplot++), which doesn't have pre-compiled versions for my needs (Windows and MinGW compiler). The same thing had happen to me with another library (opencv), ...
puccj's user avatar
  • 121
1 vote
1 answer
184 views

How to correctly link SFML staticly? (Clion, CMake, Windows 10 x64)

I'm linking SFML staticly, with CMake, and I'm getting undefined reference errors to all SFML classes or methods. CmakeLists.txt (SFML is in the same directory, and is x64): cmake_minimum_required(...
Kyrbyn YT's user avatar
1 vote
0 answers
199 views

Why sfml gives me undefined reference to `_imp____acrt_iob_func' during linking

I was trying to create the example sfml window and compile with cmake but I received the following error: undefined reference to `_imp____acrt_iob_func'. The only lib I'm using is sfml and I'm sure ...
Mateus's user avatar
  • 11
0 votes
0 answers
139 views

Linker error on "Undefined reference" to functions written a new file, but works fine when same functions are added to existing file

I have a project PROJ with an external submodule SUB. The submodule invokes some external functions f1(), f2(), f3() that are not defined in our project, so the linker fails with 'undefined reference' ...
Photonslave's user avatar
1 vote
0 answers
52 views

"undefined reference to 'WinMain@16'" when adding SDL2 libraries in C++ environment [duplicate]

I have been trying to get SDL2 to work in my environment but have had no luck. I am using Windows 10 Home with MinGW, working in Eclipse IDE for C/C++ Developers. I downloaded SDL2.26.4 from this ...
Jujimufoo's user avatar
0 votes
0 answers
18 views

Calling a function and a variable from a c file to an other file [duplicate]

When I try to access a variable or a function with extern, I get the error of 'undefined reference to'. All what I am trying to do is add id 1 to an integer variable using a function (file 1) and it ...
maSter gaMe's user avatar
0 votes
0 answers
17 views

Undefined references while installing VPFIT12.3

For installing VPFIT, I ran the command sudo make all in vpfit12.3/ But I receive the following error, ... -L/usr/lib -ldl -lm -lnsl -lpng -lpthread -lz -lcurl -lbz2 -lpng /usr/bin/ld: vpfit.o: in ...
stack's user avatar
  • 1
0 votes
0 answers
18 views

undefined reference to `Minisat::Solver::addClause_ Though its refence exists [duplicate]

I get the following error: /home/eran/CLionProjects/lambda-PDR2/minisat/minisat/core/Solver.h:339: undefined reference to `Minisat::Solver::addClause_(Minisat::vec<Minisat::Lit, int>&)' ...
edward's user avatar
  • 1
0 votes
0 answers
166 views

i am getting linking error in vs code when setting up sdl2

I am trying to setup sdl2 to vs code but getting these errors: Warning: PowerShell detected that you might be using a screen reader and has disabled PSReadLine for compatibility purposes. If you want ...
Khalid Khan's user avatar
0 votes
0 answers
34 views

Undefined reference error when creating objects and calling methods (VS Code) [duplicate]

I am somewhat of a beginner in VS code so I was not able to tackle this issue, I've been getting this error message: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-...
Mohammed Alkhateri's user avatar
3 votes
2 answers
108 views

Resolve undefined reference by stripping unused code

Assume we have the following C code: void undefined_reference(void); void bad(void) { undefined_reference(); } int main(void) {} In function bad we fall into the linker error undefined ...
Post Self's user avatar
  • 1,501
0 votes
0 answers
44 views

How to add .lib files in C static linking? (undefined reference to error)

I am trying a sample IXChariot API. These are the requirements before compiling and running the C file. IX Chariot C API requiements. I have added both the include files and the lib files in the ...
Mathesh T's user avatar
0 votes
0 answers
68 views

linking issues for qt 6.4.2 for "qInitResources_materialsystem" for iOS with Cmake

I'm trying to build an iOS application using QT6.4.2 and Cmake, I'm getting following linking error "qInitResources_materialsystem()", referenced from: QGlobalStatic<QtGlobalStatic::...
inkfil's user avatar
  • 31
0 votes
1 answer
258 views

Shaka Player - video.ui is undefined

I have the following demo page to test Shaka Player for my use case. I'd like to play live content given in an mpd file. <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"&...
Niccolò Cavallini's user avatar
0 votes
1 answer
124 views

Integrating .lib files with C code written on Linux

I have pre-existing code that was written and is running on a Linux machine. I need to add to this code, this new code which depends on a library using VS. I have decided to develop on Visual Studio ...
Mitchman029's user avatar
0 votes
1 answer
129 views

Problem compiling exiv2 code in VS 2022: Undefined Reference/symbol error

I have some code in Linux that uses exiv2 to read the metadata of a folder full of photos, depending on requirements it can reconstruct missing metadata, and stamp a logo as well as lat/long onto the ...
SciFlyGal's user avatar
0 votes
0 answers
91 views

undefined reference to raspicam

i have faced some error in camera initialization in geany compiler g++ $(pkg-config opencv4 --cflags --libs) -o g++ $(pkg-config raspicam --cflags --libs) -o cameratest cameratest.cpp (in directory: /...
Talha Faraz's user avatar
0 votes
0 answers
132 views

OpenCV v3.4.1 : undefined reference to `ippicvi' from "libopencv_world.a" that compiled by me from Linux

I tried to compile libopencv_world.a(https://opencv.org/opencv-3-4-1/) from Linux system with CMake command below. cmake \ -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D ...
Taeheon Kim's user avatar
1 vote
0 answers
302 views

Error linking SDL3 project undefined reference to `__imp_glCreateShader'

I have simple project for tests. But I can't build the project successfully with MinGW64. The project consists of CMakeLists.txt and main.cpp CMakeLists.txt cmake_minimum_required(VERSION 3.20) set(...
AlexZel's user avatar
  • 83
0 votes
0 answers
29 views

"Undefined Reference to IMG_Load" SDL_Image/SDL2 [duplicate]

I have set up a development environment in VSCode with SDL2, SDL2_Image and MinGW. I am using this command to compile the program. g++ -Isrc/include -Lsrc/lib -o main main.cpp -lmingw32 -lSDL2main -...
ScruffyNerf's user avatar
1 vote
0 answers
169 views

net-snmp linker error with camke (undefined reference to)

I'm having problems linking the net-snmp library with CMake. I successfully built the library with MinGW according to the instructions in the readme.win32 file, and now I want to run the snmpdemoapp (...
Ali Assar's user avatar
0 votes
0 answers
68 views

std::launder and undefined behaviour

I am reading the p0532r0 about std::launder and when to use to avoid UB. There is the following example. template <typename T> class coreoptional { private: T payload; public: ...
getsoubl's user avatar
  • 808
0 votes
0 answers
17 views

vscode undefined reference issue [duplicate]

I have three simple files that I have trouble compiling for some reason. When I use the terminal to compile the program (g++ .\main.cpp .\dynamic.cpp). I get this error message: C:\Users\user1\AppData\...
Kaio-n's user avatar
  • 1
0 votes
0 answers
285 views

How to get functions from a .so file into my python program?

I'm a mechanical engineer trying to make it in the world of deep learning so my knowledge of programming is pretty basic. I have a pre-compiled file in .so format and my python file (nndistance.py) ...
Gopal Kulkarni's user avatar
0 votes
0 answers
61 views

Why does c++ cannot define references to gurobi's functions while its directories are included?

I am trying to install gurobi 952 on windows 10 for c++ (CLion). I have an active gurobi license (it works with Java and Python), however, I cannot run it in c++. I looked for solutions on the ...
mdslt's user avatar
  • 163
0 votes
0 answers
51 views

Code with Opencv4 compiles but not links- not finding Mat and imshow

I am trying to create executable of following code taken from here: #include <iostream> #include <opencv2/opencv.hpp> #include <opencv2/imgcodecs.hpp> using namespace cv; using ...
rnso's user avatar
  • 23.8k
0 votes
0 answers
77 views

cmake project: undefined reference to 'xxx'

I am trying to compile CLion Project. and the CMakeList.txt set(CMAKE_SYSTEM_NAME Generic) set(CMAKE_SYSTEM_VERSION 1) cmake_minimum_required(VERSION 3.23) # specify cross-compilers and tools set(...
Cjsah's user avatar
  • 1
0 votes
1 answer
425 views

Undefined symbols in .so

I develop library and trying run tests. When I run example building I got the undefined reference errors (in example one of that errors): /opt/nt/lib/libntproto2db.so: undefined reference to ntproto::...
OlegUP's user avatar
  • 113
1 vote
0 answers
67 views

Simple C++ code with templates won't compile due to undefined references [duplicate]

I have searched high and low for answers on this but I'm still baffled. As far as I understand from the examples I've found online my code should be valid but it won't compile due to undefined ...
Petri Hirvonen's user avatar
1 vote
1 answer
725 views

g++ undefined reference to while linking with a custom shared library

I am trying to link my C++ program with a custom shared library. The shared library is written in C, however, I don't think that it should matter. My library is called libfoo.so. Its full path is /...
Setu's user avatar
  • 190

1
2 3 4 5
25