I was following "Building and Using DLLs" tutorial from https://cygwin.com/cygwin-ug-net/dll.html. I've made mydll.cpp file:
#include <iostream>
void hello()
{
std::cout << "Hello World of DLL"<< std::endl;
}
compiled and linked it:
g++ -c mydll.cpp
g++ -shared -o mydll.dll mydll.o
then tried to use hello() function in main.cpp:
int main ()
{
hello ();
}
after linking with g++ -o main main.cpp -L./ -l mydll
and got:
error: 'hello' was not declared in this scope
hello();
The tutorial states that everything should work just fine. What am I missing?