3I’m learning how to use C++ to write DLLs and am following this tutorial video to get me started. I follow along exactly, my code being:
defFile.def:
LIBRARY "square"
EXPORTS
square
funct.cpp:
double __stdcall square(double & x)
{
return x*x;
}
When trying to Build using VSE 2010, I get the following error:
1>------ Build started: Project: square, Configuration: Debug Win32 ------
1> defFile.def
1>c:\documents and settings\~\my documents\visual studio 2010\projects\square\square\deffile.def(2): error C2143: syntax error : missing ';' before 'string'
1>c:\documents and settings\~\my documents\visual studio 2010\projects\square\square\deffile.def(2): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I’ve tried adding #include <string> at the top of defFile.def, but still get the same error. I’m sure this is something really simple.
You added the .def file to your project. It is getting compiled as though it is a source code file. That can’t work.
Right-click your project, Properties, Linker, Input. Set the Module Definition File setting to “defFile.def”.