Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22072

Error following simple c++ DLL tutorial with mingw

$
0
0

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?


Viewing all articles
Browse latest Browse all 22072

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>