Category : linker-errors

Problem I am currently getting an undefined reference error for member functions defined outside a header file for a class called Vec2D. How can I resolve this error? CMakeFilesScavens.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x20): undefined reference to Vec2D<int>::Vec2D(int, int)’ CMakeFilesScavens.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x33): undefined reference to operator<<(std::ostream&, Vec2D const&)’ CMakeFilesScavens.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x59): undefined reference to Vec2D<int>::Vec2D(int, int)’ CMakeFilesScavens.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x69): undefined reference to Vec2D::operator=(Vec2D const&)’ CMakeFilesScavens.dir/objects.a(main.cpp.obj):main.cpp:(.text+0x7c): undefined ..

Read more

I have next CMakeLists.txt file on my ubuntu 21.04: cmake_minimum_required(VERSION 3.10) # set the project name project(gtk4-my) # add the executable add_executable(gtk4-my gtk4-my.c) # gtk4 find_package(PkgConfig REQUIRED) pkg_check_modules(GTK4 REQUIRED gtk4) include_directories(${GTK4_INCLUDE_DIRS}) link_directories(${GTK4_LIBRARY_DIRS}) add_definitions(${GTK4_CFLAGS_OTHER}) # Use the package PkgConfig to detect GTK+ headers/library files find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED gtkmm-3.0) target_link_libraries(gtk4-my PRIVATE ${GTKMM_LIBRARIES}) # Add other flags ..

Read more

I’m trying to build the project with linking the C++ library in Rust, which was proposed here: Linking to a C++ library that has extern "C" functions with the full example located on Github: https://github.com/renato-zannon/rust-to-cpp-example When I run cargo build (on Mac), the following error message is thrown: Compiling cpp v0.0.1 (/Users/monikak/Documents/repos/rust-to-cpp-example) warning: use of ..

Read more