Hi,
I tried to post on the forum but it kept coming up
with an internal error so i was wondering if you could help me with the
following:I have recently been trying to compile aspell (a spell checker
written in c and c++) in visual studio .NET (2003) which has taken forever but i
managed to get it to compile a dll now. When i come to add this dll file into
another project which will be using the methods from this dll it keeps giving
the following error and not allowing me to add it: "Add Reference: Error adding
reference to the project.". Does anyone have any suggestions on how to overcome
this Any information would be much appreciated.Thanks

aspell compilation problems
Jigar Lakhani
__declspec(dllexport) void __cdecl CheckerString::replace(ParmString repl);
__declspec(dllexport) bool __cdecl CheckerString::next_misspelling();
however i now get the errors come up when i compile the project:
c:\Documents and Settings\Shaun\Desktop\aspell-win32\prog\checker_string.cpp(16): error C2761: 'bool CheckerString::next_misspelling(void)' : member function redeclaration not allowed
c:\Documents and Settings\Shaun\Desktop\aspell-win32\prog\checker_string.cpp(15): error C2761: 'void CheckerString::replace(acommon::ParmString)' : member function redeclaration not allowed
im guessing this is because there is no main method where they are used but are declared as their own methods further down the code. p.s. i have tried adding them in different parts of the class but there is no change.
Wally_West
You're making settings in an attempt to fix the problem that are causing other problems. The MSDN docs for LNK1149 makes it pretty clear on what the solution is.
Fix the LNK1149 and see if the problem goes away.
To be sure you're on track, ASPELL.LIB is not "included" like header files are. They are added to the linker settings. (Project Properties->Linker->Input->Additional Dependencies.)
Brian
jml81
perryf_00
I am actually still only running visual studio 2003. However i now no longer get those errors i now get:
aspellcmd fatal error LNK1141: failure during build of exports file
aspellcmd fatal error LNK1149: output filename matches input filename 'c:\Documents and Settings\Shaun\Desktop\aspell-win32\Debug\aspell.lib'
which i have found confusing because as far as i know i need the aspell.lib file included in the project.
smaynard123
The usual way class definitions are exported is to prepend "class Foo" with __declspec(dllexport). Since this header is used by both the build of the DLL and the client code, a macro is introduced that evaluates to either __declspec(dllexport) or empty (or __declspec(dllimport), but that's a more advanced topic).
To see this, use the Win32 DLL wizard in Visual Studio to create a DLL project from scratch: the wizard sets this up for you. Maybe aspell is doing this already, but the macro needed to enable __declspec(dllexport) is not being defined in the build of aspell.
Brian
szembek
CopyPtr is a template that appears to lack a destructor. Can you define one
Marcas
~CopyPtr(){delete impl;};
i now dont get any build errors when i run the debug and it calls my exe file but when i build the solution i still get the below error:
aspellcmd error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall acommon::CopyPtr<class acommon::DocumentChecker>::~CopyPtr<class acommon::DocumentChecker>(void)" (__imp_ 1 $CopyPtr@VDocumentChecker@acommon@@@acommon@@QAE@XZ) referenced in function __unwindfunclet$ 0CheckerString@@QAE@PAUAspellSpeller@@PAU_iobuf@@1H@Z$0
Aaron Anderson
There's a difference between plain DLL's and .NET assemblies (which can be through DLL's). Add Reference makes a reference to a .NET assembly. Chances are you're working with a plain DLL.
The DLL should have a header that your executable build uses (which prototype functions exported from the DLL), and an import library (aspell.lib ) that your executable build links against. You specify this under Project Properties->Linker->Input->Additional Dependencies.
Brian
Tung
Just put __declspec(dllexport) before "class" and every method will be exported. (I have said this.)
Make sure you really are using the right version of the lib (the one you just built).
Go to the Visual Studio 2005 Command Prompt (under Tools), find your DLL, and type:
dumpbin -exports aspell.dll
This should verify that your methods are being exported.
Brian
JoelSSIS
You class methods need to be exported from the dll. I would read up on the topic:
http://msdn.microsoft.com/library/default.asp url=/library/en-us/vccore/html/_core_export_from_a_dll_using___declspec.28.dllexport.29.asp
greg_burns
aspellcmd error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall acommon::CopyPtr<class acommon::DocumentChecker>::CopyPtr<class acommon::DocumentChecker>(class acommon::DocumentChecker *)" (__imp_ 0 $CopyPtr@VDocumentChecker@acommon@@@acommon@@QAE@PAVDocumentChecker@1@@Z) referenced in function "public: __thiscall CheckerString::CheckerString(struct AspellSpeller *,struct _iobuf *,struct _iobuf *,int)" ( 0CheckerString@@QAE@PAUAspellSpeller@@PAU_iobuf@@1H@Z)
aspellcmd error LNK2019: unresolved external symbol "__declspec(dllimport) public: class acommon::DocumentChecker * __thiscall acommon::CopyPtr<class acommon::DocumentChecker>::operator->(void)const " (__imp_ C $CopyPtr@VDocumentChecker@acommon@@@acommon@@QBEPAVDocumentChecker@1@XZ) referenced in function "public: __thiscall CheckerString::CheckerString(struct AspellSpeller *,struct _iobuf *,struct _iobuf *,int)" ( 0CheckerString@@QAE@PAUAspellSpeller@@PAU_iobuf@@1H@Z)
aspellcmd error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall acommon::CopyPtr<class acommon::DocumentChecker>::reset(class acommon::DocumentChecker *)" (__imp_ reset@ $CopyPtr@VDocumentChecker@acommon@@@acommon@@QAEXPAVDocumentChecker@2@@Z) referenced in function "public: __thiscall CheckerString::CheckerString(struct AspellSpeller *,struct _iobuf *,struct _iobuf *,int)" ( 0CheckerString@@QAE@PAUAspellSpeller@@PAU_iobuf@@1H@Z)Not sure if this helps explain what is happening better
diwakar_pal11
ihsanakin
PERECil