[LONG POST WARNING]
I am trying to build a DLL in Dev-C++... I have a standard install (Version
4, mingw, with the 4.01 upgrade, and the mingw 1.1 upgrade, but I got same
problem before I upgraded mingw) so I'm asking here to get an idea of what
I'm doing wrong, I think it's a user error more than a compiler error... <G>
I started a DLL C++ project, added these two files, print.cpp and print.h.
PRINT.CPP
------------
#include "print.h"
__declspec(dllexport) void printMessage()
{
// Print out a message
cout << "message from the .dll" << endl << endl;
}
------------
PRINT.H
------------
#ifndef PRINT_H
#define PRINT_H
#include <iostream>
using namespace std;
__declspec(dllexport) void printMessage();
#endif
------------
When I compile it, I get the following output from the compiler log
COMPILER LOG
------------
Reading specs from D:/DEV-C_~1/BIN/../lib/gcc-lib/mingw32/2.95.3-6/specs
gcc version 2.95.3-6 (mingw special)
D:\DEV-C_~1\BIN\..\lib\gcc-lib\mingw32\2.95.3-6\cpp0.exe -lang-c++ -v -I.
-ID:\DEV-C_~1\INCLUDE\ -ID:\DEV-C_~1\INCLUDE\G__~1 -ID:\DEV-C_~1\INCLUDE\
-iprefix D:\DEV-C_~1\BIN\../lib/gcc-lib/mingw32/2.95.3-6/ -isystem
D:/DEV-C_~1/BIN/include -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95
-D__cplusplus -Di386 -D_WIN32 -DWIN32 -D__WIN32__ -D__MINGW32__=1.0
-D__MSVCRT__ -DWINNT -D_X86_=1 -D__STDC__=1
-D__stdcall=__attribute__((__stdcall__))
-D_stdcall=__attribute__((__stdcall__)) -D__cdecl=__attribute__((__cdecl__))
-D__declspec(x)=__attribute__((x)) -D__i386__ -D_WIN32 -D__WIN32__
-D__WIN32__ -D__MINGW32__=1.0 -D__MSVCRT__ -D__WINNT__ -D_X86_=1
-D__STDC__=1 -D__stdcall=__attribute__((__stdcall__))
-D___stdcall__=__attribute__((__stdcall__))
-D__cdecl=__attribute__((__cdecl__)) -D__declspec(x)=__attribute__((x))
-D__i386 -D__WIN32 -D__WINNT -D___stdcall=__attribute__((__stdcall__))
-Asystem(winnt) -Acpu(i386) -Amachine(i386) -D__EXCEPTIONS -H -remap
-Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -DBUILDING_DLL=1
d:\gt\new projects 4\using a dll\printdll\print.cpp
C:\WIN98\TEMP\ccvrxdfb.ii
GNU CPP version 2.95.3-6 (mingw special) (80386, BSD syntax)
#include "..." search starts here:
#include <...> search starts here:
.
D:/DEV-C_~1/INCLUDE
D:/DEV-C_~1/INCLUDE/G__~1
D:/DEV-C_~1/INCLUDE
D:/DEV-C_~1/BIN/../lib/gcc-lib/mingw32/2.95.3-6/../../../../include
D:/DEV-C_~1/BIN/../lib/gcc-lib/mingw32/2.95.3-6/../../../../mingw32/include
D:/DEV-C_~1/BIN/../lib/gcc-lib/mingw32/2.95.3-6/include
End of search list.
The following default directories have been omitted from the search path:
/mingw/lib/gcc-lib/mingw32/2.95.3-6/../../../../include/g++-3
/usr/local/mingw32/include
End of omitted list.
d:/gt/new projects 4/using a dll/printdll/print.h
D:/DEV-C_~1/INCLUDE/G__~1/iostream
D:/DEV-C_~1/INCLUDE/G__~1/iostream.h
D:/DEV-C_~1/INCLUDE/G__~1/streambuf.h
D:/DEV-C_~1/INCLUDE/G__~1/libio.h
D:/DEV-C_~1/INCLUDE/_G_config.h
D:/DEV-C_~1/INCLUDE/stddef.h
D:\DEV-C_~1\BIN\cc1plus.exe C:\WIN98\TEMP\ccvrxdfb.ii -quiet -dumpbase
print.cc -mwindows -version -o C:\WIN98\TEMP\ccAaD6db.s
GNU C++ version 2.95.2 19991024 (release) (i386-mingw32msvc) compiled by GNU
C version 2.95.2 19991024 (release).
D:\DEV-C_~1\BIN\as.exe -o print.o C:\WIN98\TEMP\ccAaD6db.s
------------
and the linker output is :
LINKER OUTPUT
--------------
d:\gt\new projects 4\using a dll\printdll\print.o(.text+0x22):print.cpp:
undefined reference to `endl(ostream &)'
d:\gt\new projects 4\using a dll\printdll\print.o(.text+0x2a):print.cpp:
undefined reference to `endl(ostream &)'
d:\gt\new projects 4\using a dll\printdll\print.o(.text+0x37):print.cpp:
undefined reference to `cout'
d:\gt\new projects 4\using a dll\printdll\print.o(.text+0x3c):print.cpp:
undefined reference to `ostream::operator<<(char const *)'
D:\DEV-C_~1\BIN\dllwrap: no export definition file provided
D:\DEV-C_~1\BIN\dllwrap: creating one, but that may not be what you want
D:\DEV-C_~1\BIN\dllwrap: D:\DEV-C_~1\BIN\gcc exited with status 1
--------------
I've included libstdc++.a in the project options (suggested in the mingw
forum), but still no go.. Some people (in mingw list) have suggested how to
do it via the command line, but those options didn't work either. I would
really like to learn how to do this through the Dev-C++ IDE, which I'm sure
somebody has done...
If anyone could enlighten me, I would greatly appreciate it.
Thanks,
Mike
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
|