I am trying to compile simple c++ code with golang but there are a few errors:
// namespace test
// {
// int val = 500;
// }
//
import "C"
Output: error: unknown type name ‘namespace’
This is most likely because the the compiler is for C and not C++; how can I change this?
// #include <algorithm>
import "C"
Output: fatal error: algorithm: No such file or directory
The include file exists and is found by g++
; but the go compiler does not find the file. What do I need to change here? I do not want to include every folder manually.
It’s a C++ header file at /usr/include/c++/8/algorithm
; are these headers not included because it’s C and not C++?
I have seen the howto-go-with-cpp but this workaround is not good for the build stack and the deps that I use because it requires to modify the included header files.
Go verions: go1.11.6 linux/arm
on a RPi.