not sure how to get this too compile, i have tried an updated mingw, but still get the same error
#include <functional>
void foo() { }
int main() {
std::function<void()> f(foo);
}
Quote
obj\Debug\main.o||In function `main':|
C:\Users\vurentjie-64\My Code\CPP\test_functional\main.cpp|4|undefined reference to `___stack_chk_guard'|
C:\Users\vurentjie-64\My Code\CPP\test_functional\main.cpp|7|undefined reference to `___stack_chk_guard'|
C:\Users\vurentjie-64\My Code\CPP\test_functional\main.cpp|7|undefined reference to `___stack_chk_fail'|
||=== Build finished: 3 errors, 0 warnings ===|
trying to use std::function seems to be the cause of this, for instance i can get something simple like this working
auto func = [](){ std::cout << "Hello" << std::endl; };
func();
i don't actually think this is cb specific but perhaps someone else has dealt with this before.
i stumbled on this while trying to pass lambda's as arguments.
the following also errors the same
std::function<void ()> fn=[](){ std::cout << "Hello" << std::endl; };
nevermind, this is me being silly, the error is coming from fstack protector
It works for me with the providing code.
Note that it is a linker issue, not a compiler issue.
I succeeded to reproduce the bug by adding -fstack-protector -fstack-protector-all options.
Quote from: jarod42 on June 26, 2012, 04:28:00 PM
Note that it is a linker issue, not a compiler issue.
Note that this question is not related to C::B and therefore violates our forum rules.
Topic locked !!