29,371 questions
-2
votes
1
answer
34
views
CLion with the bundled MinGW throws up 'undefined reference" for every function call in my source file [closed]
Attempting to run this code:
#include "modules/UserInputHandling.h"
using namespace std;
int main(int argc, char *argv[])
{
int input = user_input_handling(argc,argv);
}
...produces:
C:\...
1
vote
0
answers
30
views
How do I deal with function parameters that shadow variables from the parent scope?
I have a function like this:
function(append_one ones)
list(APPEND one_more ${${ones}} "1")
set(${ones} ${one_more} PARENT_SCOPE)
endfunction()
So that I can call it repeatedly:
...
2
votes
0
answers
44
views
libstdc++.so links error when try to use pybind11/3.0.1 of conan-2 and cpp23 in wsl
In WSL (Ubuntu 24.04), when using Conan to create a package that links pybind11/3.0.1, the resulting executable in the test_package fails to run.
Even if the executable doesn't directly call any ...
1
vote
1
answer
32
views
Cannot include header files inside the header files in library project (With executable project for testing)
I am creating an C++ library which inside the library codebase includes are more freely defined than on an executable.
For example:
#include "base_task.h" Inside library in comparison to #...
Best practices
0
votes
1
replies
24
views
How to find_package(... OPTIONAL) in CMake 3?
I would like to check whether Catch2 is installed, and if not then FetchContent it. CMake 4 has the OPTIONAL keyword to try find_package without throwing a warning. So, you can do something like this:
...
4
votes
1
answer
199
views
Why when I build my Python library from C code, the Python functions don't work
I'm trying to build a Python library from C code. I'm on macOS.
When I only build the .so file and link it in Python like this, all the functions work as intended:
import sys
sys.path.append("...
-1
votes
0
answers
67
views
how to get cmake to work sfml 3 cross platform
I am trying to get sfml to link with cmake dynamically to my c++ project, and I would like to work cross platform with Windows and Linux. My (AI generated) CMakeLists.txt is not worth sharing becuause ...
0
votes
1
answer
35
views
How to include external library for my module dependency on ESP-IDF project?
I'm new to C++, cmake and esp-idf coding. My code project is as per Expressif's structure. I found aC++ BLE library https://github.com/h2zero/esp-nimble-cpp/tree/master that I'd liketo include. Their ...
1
vote
0
answers
78
views
cuda & cpp - compilation and linking using cmake
I want to create a skeleton for a project in which there are multiple cuda and cpp files. They will be compiled individually and then linked together to form a single executable.
Currently I have the ...
-2
votes
0
answers
50
views
SCIP make test do not give me .err file
I am trying to compare two algorithms in SCIP. To do this, I am following the steps in https://www.scipopt.org/scip/doc/html/TEST.php, but it says that SCIP automatically creates the scip/check/...
3
votes
0
answers
101
views
Rebuilding C++20 module dependencies [duplicate]
I created a C++20 module (file module.ixx):
export module M;
void foo() {}
export void bar() { foo(); }
Then I created code that uses this module (main.cc):
import M;
int main() { bar(); }
...
0
votes
1
answer
62
views
Build fails after lowering minSdkVersion to 22 — User has minSdkVersion 22 but library was built for 24 [//ReactAndroid/hermestooling]
I have a React Native project that must support minSdkVersion 22. I changed the Android minSdkVersion to 22 in my app but the Gradle build fails complaining that a native ReactAndroid library (...
0
votes
0
answers
30
views
How to make cmake fail if the keywords PRIVATE/PUBLIC are not present in target_link_libraries
I work on a very large project, And I would like to enforce the rule that every target_link_libraries should set the PRIVATE/PUBLIC/INTERFACE keywords.
Checking manually is hopeless, thus I was ...
-1
votes
0
answers
19
views
How to get compiler major version in CMake? [duplicate]
I have a build that needs to support multiple architectures and compiler versions, and involves finding a header that will be in a versioned directory.
find_path(BACKTRACE_INCLUDE backtrace.h PATHS
...
0
votes
0
answers
54
views
How to override the -fuse-ld flag in CLion?
I have a CMake based Windows library project that only links successfully with the MSVC link.exe due to some obscure third party library dependencies. However, I want to compile the project using the ...
2
votes
0
answers
65
views
Qt's MOC can not find headers under include/projname [duplicate]
This question is not a duplicate of undefined reference to `vtable for MainWindow'. As I have mentioned in the following I know how to solve the compile error but my question is how to solve the ...
0
votes
1
answer
152
views
Cannot specify link libraries for target "react_codegen_pagerview" which is not built by this project
Environment
React Native version: 0.82.1
react-native-pager-view version: 6.9.1
Platform: Only Android
New Architecture: true
Description
Execution failed for task ':app:configureCMakeDebug[arm64-v8a]'...
0
votes
0
answers
43
views
CMake Error: "file INSTALL cannot find file: File exists" when building linphone-desktop
I'm trying to build the linphone-desktop application on Windows and encountering a contradictory CMake error during installation:
CMake Error at external/linphone-sdk/external/soci/src/core/...
2
votes
0
answers
68
views
Sample project with STM32CubeMX (CMake) code generation for STM32F407G-DISC1 [closed]
I am generating code from STM32CubeMX (CMake projecct) and keeping it is separate folder. What CMake code so I now need in my App so that I can use generated code from the STM32CubeMX, and write my ...
1
vote
1
answer
191
views
Why is my CMakeLists.txt getting included in my Python package?
I'm building a Python package using scikit-build and Pybind11, but I'm having an issue where my package in site-packages is including one of my CMakeLists.txt. Here is my project structure:
pybind11-...
1
vote
1
answer
116
views
Can't find DLLs for linking OpenCV to project [closed]
I am using Visual Studio 2022 and CMake to build my project.
In a third_party directory under the project root, I extracted the OpenCV build from the OpenCV 4.12.0 windows downloader.
In a CMakeLists....
0
votes
1
answer
39
views
How to target_sources(PUBLIC FILE_SET HEADERS … with configured file in ./build/ directory
Setup: modern(ish) CMake 3.31.6, main CMakeLists.txt below.
As you can see, I'm generating a version.h at cmake time.
This all works fine when I run
cmake -S . -B /tmp/build
from the project ...
0
votes
0
answers
60
views
hunter: Unexpected empty string : hunter_assert_not_empty_string("${x_VERSION}")
For the very first time I'm using Hunter.
(base) raphy@raohy:~/MyPrj$ mkdir cmake
(base) raphy@raohy:~/MyPrj$ wget https://
raw.githubusercontent.com/cpp-pm/gate/master/cmake/HunterGate.cmake -O cmake/...
2
votes
1
answer
84
views
How to link with static version of zlib in CMake?
I built my version of zlib (and by default it builds both static and dynamic) but seemingly it can't find the static one because it's being "zs.lib" and not in the preferred list so it can't ...
1
vote
0
answers
108
views
CMake: QML warnings on Ubuntu 25.04: "link target it defines (Qt6::qtquick2plugin) does not exist in the current scope"
I'm trying to build Noteahead MIDI tracker (https://github.com/juzzlin/Noteahead) on Ubuntu 25.04 and getting a lot of CMake warnings like these:
CMake Warning at /usr/lib/x86_64-linux-gnu/cmake/...