How to create a C++ DLL for Excel VBA using visual studio 2008?

I have just watched a video tutorial on how to set up a C++ DLL file to call in Excel VBA. I'm just doing a simple one to start off with. So I open a new win32 project and chose DLL and empty project in the application wizard and proceed. Then I make a .cpp file and a .def file as follows:

square.cpp file:

1
2
3
4
double __stdcall square(double & x)
{
         return x*x;
}



defFile.def:

1
2
3
LIBRARY "square"
EXPORTS
square



Then to project properties -> Linker -> input-> Module Definition File: defFile.def

and then I compile.


Now, a .dll file should appear in the project Debug folder, but it doesn't. :( Any idea's whats wrong?


P.S. I'm fairly new to programming so try and go easy on the terminology. :p

Any help appreciated! :)

Oh and I'm using VC++ 2008. Is there any other updated version i can download for free anywhere? 2008 one was the best I could find.

EDIT: Problem solved. I was compiling only the function before, when I compile the whole project I get no such problem, incase anyone is curious.
Last edited on
Topic archived. No new replies allowed.