Help with C++

  • Thread starter Thread starter Eric.Z
  • Start date Start date
Joined
12/13/11
Messages
83
Points
18
hey guys, I am trying to create c++ dll for excel. Below are the files i have:
Code:
defFile.def:
LIBRARY "square"
EXPORTS
square
Code:
square.cpp:
double __stdcall square(double& x){
return x*x;
}
the two error message I got is:
deffile.def(1): error C2143: syntax error : missing ';' before 'string
deffile.def(1): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

I am using VS2010 on windows 7 64bit...Not sure if this would make a difference.
Why am I having these error messages?
 
hey guys, I am trying to create c++ dll for excel. Below are the files i have:
Code:
defFile.def:
LIBRARY "square"
EXPORTS
square
Code:
square.cpp:
double __stdcall square(double& x){
return x*x;
}
the two error message I got is:
deffile.def(1): error C2143: syntax error : missing ';' before 'string
deffile.def(1): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

I am using VS2010 on windows 7 64bit...Not sure if this would make a difference.
Why am I having these error messages?

Could be a number of reasons; your code looks OK as such. Did you #include <objbase.h>, for example? also windef.h??
 
Could you post the full code?
What I posted is all the code I have. Here is exactly what I did to create this project.
I basically created a win32 dll project under VS2010 and created these two files called square.cpp and defFile.def under the folder called source files. The code I posted above is all I have in these two files I created. It is supposed to be a simple program~~
Is it possible to be the problem of my 64bit operating system or VS2010?
 
I used to created DLLs from the DOS Promt (CLI) using MS VC++ compiler cl.exe (/LD option) without launching Visual Studio.

But you need to set the environment first. For which, find the file vsvars32.bat and run it from CLI. For help Type cl /? for parameters or look up: http://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx

I saved a file with the contents of square.cpp and compiled as "cl /LD square.cpp" it did output square.dll. Try to compile only this file and isolate the problem. Remember to run vsvars32.bat first.
 
here is a .def file that is generate from ATL projcts

Code:
; BlackScholesAddin.def : Declares the module parameters.
 
LIBRARY      "BlackScholesAddin.DLL"
 
EXPORTS
    DllCanUnloadNow        PRIVATE
    DllGetClassObject    PRIVATE
    DllRegisterServer    PRIVATE
    DllUnregisterServer    PRIVATE
 
Back
Top Bottom