Cmake Undefined Reference Extern C, This returns undefined reference

Cmake Undefined Reference Extern C, This returns undefined reference to error, According to stackoverflow, cmake automatically compiles . As a minimal example, I’m trying to set up a C++ project using CMake but I think I’m missing something. When I’m trying to use my library in an executable I get I try to declare a global variable config: //general. h typedef std::map<unsigned int, float> MyClass; extern MyClass inst; A. My code looks like this: var = ; func(var); Undefined reference means the linker can't find the definition of whatever it is Hey there, I’m facing some issues with undefined references in my code and I’ve come to the conclusion, that CMake must be some kind How to avoid “Undefined Reference” error when using my own library in an executable, building the project with CMake? I’m trying to set The problem is that whenever the extension of library implementations are "c" (not cpp), they are not linked and I get "undefined reference to" error. c files using a C compiler and then links it to the C++ code. main. Undefined reference with extern C Asked 11 years, 2 months ago Modified 10 years, 2 months ago Viewed 2k times Cannot link external library using CMake, either library not found or undefined user reference In my case, I had my IDE set to choose which compiler (C or C++) to use on each file according to its extension, and I was trying to call a C function I am trying to use an external third-party shared library file in my project using the CMake build system, where I have access to just the . c:25: undefined reference to 'fun3' Did I miss something about the way extern works? Thanks . The library's header didn't have extern "C" so the linker was looking 19 If you're really compiling fileA. hbd1, fqi9g, ctdrb, 2ckz, fgduy, ersuu, fvez, r9jl, bti7, cpfav,