cl.exe -  
Author Message
Mapa3matuk





PostPosted: Visual C++ Express Edition, cl.exe - Top

Hi guyz,

I got the following problem with cl.exe

When i try to compile my cpp file through IDE its ok, but when i go command line and use cl.exe i get the following error:

C:\Documents and Settings\Dmitry\My Documents\Visual Studio 2005\Projects\MyDll\MyDll>cl /DLL MyDll.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.42 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.

MyDll.cpp
Microsoft (R) Incremental Linker Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.

/out:MyDll.exe
MyDll.obj
LINK : fatal error LNK1561: entry point must be defined

It is a dll project file, and it has main as an entry poin (DllMain) it looks like that:

#include "stdafx.h"

#ifdef _MANAGED

#pragma managed(push, off)

#endif

BOOL APIENTRY DllMain( HMODULE hModule,

DWORD ul_reason_for_call,

LPVOID lpReserved

)

{

return TRUE;

}

#ifdef _MANAGED

#pragma managed(pop)

#endif

}

I did however put a normal main in there e.g int main(){} and it worked, so is it the way it should be solved or i have just somehow overcome the issue

Many thanks in advace guyz



Visual Studio Express Editions6  
 
 
orcmid





PostPosted: Visual C++ Express Edition, cl.exe - Top

C:\Documents and Settings\Dmitry\My Documents\Visual Studio 2005\Projects\MyDll\MyDll>cl /DLL MyDll.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.42 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.

It's not building a DLL for you, it is trying to make a standard application.

The option to make a DLL is /LD, not /DLL.

To find out what all (well, almost all) of the options are, use command

cl /

- Dennis



 
 
Mapa3matuk





PostPosted: Visual C++ Express Edition, cl.exe - Top

thanks a lot Dennis....its working :)