-
Trying to link a C++ shared lib with a minimal (1 function) project('test',['cpp', 'c'],default_options: ['cpp_std=c++20', 'c_std=c23', 'cpp_rtti=false']) The C++ shared lib:// mylib.h
#pragma once
#ifdef __cplusplus
extern "C"
#endif /* isocpp.org/wiki/faq/mixing-c-and-cpp#call-cpp */
void myTest(); // mylib.cpp
#include <cstdio>
void myTest() {
printf("Hello!\n");
} # meson.build
mylib = shared_library(
'mylib',
sources: ['mylib.cpp'],
) The C executable:# meson.build
executable(
'test.exec',
link_with: [mylib],
implicit_include_directories: true,
# link_language: 'c', # problem persists with this both on or off
sources: ['main.c'],
) // main.c
#include "mylib.h"
int main() {
myTest();
} The problem:The
Well, the |
Beta Was this translation helpful? Give feedback.
Answered by
metaleap
Jan 11, 2025
Replies: 1 comment
-
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
metaleap
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#include "mylib.h"
was missing inmylib.cpp
...