mIRC Home    About    Download    Register    News    Help

Print Thread
Compiling problem with Dev-C++ #180975 15/07/07 11:55 PM
Joined: May 2006
Posts: 2
B
behrendt Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
B
Joined: May 2006
Posts: 2
Hi,

I was trying to create a simple DLL wich should return "Hello World", but I failed.

I am using Dev-C++ (4.9.9.2)

Here is what I did:

File -> new -> project -> DLL -> Project1

Adding...


dllmain.cpp

Code:
#include <windows.h>

extern "C" int WINAPI func(HWND,HWND,char *data,char*,BOOL,BOOL)
{
	lstrcpy(data,"Hello World");
	return 3;
}


dllmain.def

Code:
LIBRARY Project1
EXPORTS
func


After compiling, "Makefile.win" is being activated and there is this red marked:


dllmain.o: dllmain.def
$(CPP) -c dllmain.def -o dllmain.o $(CXXFLAGS)


And here the compiler log:

Code:
37 C:\Dev-Cpp\Makefile.win [Warning] overriding commands for target `dllmain.o' 
34 C:\Dev-Cpp\Makefile.win [Warning] ignoring old commands for target `dllmain.o' 
34 C:\Dev-Cpp\Makefile.win [Build Error] multiple definition of `dllinfo@24' 
34 C:\Dev-Cpp\Makefile.win [Build Error] first defined here 
34 C:\Dev-Cpp\Makefile.win [Build Error] ld returned 1 exit status 
 C:\Dev-Cpp\Makefile.win [Build Error]  [Project1.dll] Error 1 


This is my first try at creating a DLL, so can anyone help me out here?

Re: Compiling problem with Dev-C++ [Re: behrendt] #181376 22/07/07 06:25 PM
Joined: Dec 2002
Posts: 89
N
Necroman Offline
Babel fish
Offline
Babel fish
N
Joined: Dec 2002
Posts: 89
Try to remove the .DEF file from your project and add the following to "Project Options", "Linker parameters":

--def dllmain.def

I have no idea how Dev-C++ works - just googling.

Re: Compiling problem with Dev-C++ [Re: behrendt] #181438 23/07/07 04:19 PM
Joined: Dec 2002
Posts: 580
N
NaquadaServ Offline
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 580
Did the previous advice work? My makefile knowledge is a bit rusty but this...

dllmain.o: dllmain.def
$(CPP) -c dllmain.def -o dllmain.o $(CXXFLAGS)

... is saying to produce dllmain.o (the object code for dllmain.cpp), execute the command "$(CPP) -c dllmain.def -o dllmain.o $(CXXFLAGS)". Clearly incorrect since your source file is dllmain.cpp.

The dllmain.def after the colon (on the first line), is OK... That is just saying that if the def file changes, recompile dllmain.cpp.


NaquadaBomb
www.mirc-dll.com