473,386 Members | 1,708 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Compiler bug creating a module with Visual C++

I get a link error when I try and create a module of the following
very simple managed C++ code. I can't imagine a more minimum piece of
code, so I imagine that this is some sort of compiler bug.

#using <mscorlib.dll>
__gc public class Test : public System::Object
{
};

$ cl /clr:noAssembly /LD test.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 13.10.3077 for .NET
Framework
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.

test.cpp
Microsoft (R) Incremental Linker Version 7.10.3077
Copyright (C) Microsoft Corporation. All rights reserved.

/out:test.dll
/noentry
/noassembly
/dll
/implib:test.lib
test.obj
LIBCMT.lib(crt0.obj) : error LNK2019: unresolved external symbol _main
referenced in function _mainCRTStartup
test.dll : fatal error LNK1120: 1 unresolved externals
Nov 16 '05 #1
6 2832
That does not look like a bug. Since you are asking it to create a
executable, it could not find an entry point. If you do the same in C# ..
using System;
public class Test {
}

and compile this, it will complain about "no entry point".

This is just complaining in C++ speak. :)
--
Girish Bharadwaj
"Peter Ross" <pr*@missioncriticalit.com> wrote in message
news:88**************************@posting.google.c om...
I get a link error when I try and create a module of the following
very simple managed C++ code. I can't imagine a more minimum piece of
code, so I imagine that this is some sort of compiler bug.

#using <mscorlib.dll>
__gc public class Test : public System::Object
{
};

$ cl /clr:noAssembly /LD test.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 13.10.3077 for .NET
Framework
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.

test.cpp
Microsoft (R) Incremental Linker Version 7.10.3077
Copyright (C) Microsoft Corporation. All rights reserved.

/out:test.dll
/noentry
/noassembly
/dll
/implib:test.lib
test.obj
LIBCMT.lib(crt0.obj) : error LNK2019: unresolved external symbol _main
referenced in function _mainCRTStartup
test.dll : fatal error LNK1120: 1 unresolved externals

Nov 16 '05 #2
Doh! I did not read the complete message. :) It does not seem to make sense
since you are passing /noentry.. why is it complaining..
sorry. ignore my last post.

--
Girish Bharadwaj
"Girish Bharadwaj" <girishb.at.mvps.dot.org> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
That does not look like a bug. Since you are asking it to create a
executable, it could not find an entry point. If you do the same in C# ..
using System;
public class Test {
}

and compile this, it will complain about "no entry point".

This is just complaining in C++ speak. :)
--
Girish Bharadwaj
"Peter Ross" <pr*@missioncriticalit.com> wrote in message
news:88**************************@posting.google.c om...
I get a link error when I try and create a module of the following
very simple managed C++ code. I can't imagine a more minimum piece of
code, so I imagine that this is some sort of compiler bug.

#using <mscorlib.dll>
__gc public class Test : public System::Object
{
};

$ cl /clr:noAssembly /LD test.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 13.10.3077 for .NET
Framework
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.

test.cpp
Microsoft (R) Incremental Linker Version 7.10.3077
Copyright (C) Microsoft Corporation. All rights reserved.

/out:test.dll
/noentry
/noassembly
/dll
/implib:test.lib
test.obj
LIBCMT.lib(crt0.obj) : error LNK2019: unresolved external symbol _main
referenced in function _mainCRTStartup
test.dll : fatal error LNK1120: 1 unresolved externals


Nov 16 '05 #3
BTW: the same code compiles just fine on a .NET 1.0.

cl /clr:noAssembly /LD empty.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 13.00.9466 for .NET
Framework
Copyright (C) Microsoft Corporation 1984-2001. All rights reserved.

empty.cpp
Microsoft (R) Incremental Linker Version 7.00.9466
Copyright (C) Microsoft Corporation. All rights reserved.

/out:empty.dll
/noentry
/noassembly
/dll
/implib:empty.lib
empty.obj
I guess you are right. This probably is something funky with the .NET 1.1 ..

--
Girish Bharadwaj
"Girish Bharadwaj" <girishb.at.mvps.dot.org> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
That does not look like a bug. Since you are asking it to create a
executable, it could not find an entry point. If you do the same in C# ..
using System;
public class Test {
}

and compile this, it will complain about "no entry point".

This is just complaining in C++ speak. :)
--
Girish Bharadwaj
"Peter Ross" <pr*@missioncriticalit.com> wrote in message
news:88**************************@posting.google.c om...
I get a link error when I try and create a module of the following
very simple managed C++ code. I can't imagine a more minimum piece of
code, so I imagine that this is some sort of compiler bug.

#using <mscorlib.dll>
__gc public class Test : public System::Object
{
};

$ cl /clr:noAssembly /LD test.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 13.10.3077 for .NET
Framework
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.

test.cpp
Microsoft (R) Incremental Linker Version 7.10.3077
Copyright (C) Microsoft Corporation. All rights reserved.

/out:test.dll
/noentry
/noassembly
/dll
/implib:test.lib
test.obj
LIBCMT.lib(crt0.obj) : error LNK2019: unresolved external symbol _main
referenced in function _mainCRTStartup
test.dll : fatal error LNK1120: 1 unresolved externals


Nov 16 '05 #4
Hi Peter,
I get a link error when I try and create a module of the following
very simple managed C++ code. I can't imagine a more minimum piece of
code, so I imagine that this is some sort of compiler bug.

#using <mscorlib.dll>
__gc public class Test : public System::Object
{
};


Not at all. You're running against the changes made to the compiler/linker
to minimize the Loader-Lock problem (a module is esentially a dll, and will
be subject to the same problems).

To get around it, just link with nochkclr.obj:
cl /clr:noAssembly /LD test.cpp nockclr.obj

--
Tomas Restrepo
to****@mvps.org
Nov 16 '05 #5
"Tomas Restrepo \(MVP\)" <to****@mvps.org> wrote in message news:<#U**************@tk2msftngp13.phx.gbl>...
Hi Peter,
I get a link error when I try and create a module of the following
very simple managed C++ code. I can't imagine a more minimum piece of
code, so I imagine that this is some sort of compiler bug.

#using <mscorlib.dll>
__gc public class Test : public System::Object
{
};


Not at all. You're running against the changes made to the compiler/linker
to minimize the Loader-Lock problem (a module is esentially a dll, and will
be subject to the same problems).

To get around it, just link with nochkclr.obj:
cl /clr:noAssembly /LD test.cpp nockclr.obj


Thank you Tomas that did solve the problem.

I had seen some KB articles about the Loader-Lock problem, but
couldn't relate it directly to my problem.

Could you point me to a resource which mentions nochkclr.obj? I am
interested to see why I didn't work it out.

Regards,
Peter
Nov 16 '05 #6
Hi Peter,
Thank you Tomas that did solve the problem.

I had seen some KB articles about the Loader-Lock problem, but
couldn't relate it directly to my problem.
It was a logical conclusion for me, since modules are usually linked into an
assembly, typically a DLL one (and not an EXE).
Could you point me to a resource which mentions nochkclr.obj? I am
interested to see why I didn't work it out.


Humm... let me see... I believe the documentation mentions it... See [1] and
[2]

[1]
http://msdn.microsoft.com/library/de...rorlnk2019.asp
[2]
http://msdn.microsoft.com/library/en...omixedmode.asp

--
Tomas Restrepo
to****@mvps.org
Nov 16 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Eric | last post by:
It seems like this is the second time I have come across this with a Pythonmodule, and I'd like to get some perspective on it. I tried to build PyPerl (on my Win XP machine) and got the following:...
1
by: Jeff Hagelberg | last post by:
I'm trying to create a python module which can be used by a python interpreter embedded inside a fortran program I have. To do this, I first created python wrappers for all the functions in my...
6
by: David Lack | last post by:
Hi, I recently installed a 60-day trial of .NET 2003 on my development system. I made tests with previous personal projects (which compiled ok with VC6) and some open source files, and keep...
3
by: Jonathan Wilson | last post by:
Is it possible to use vcbuild with the free MS compiler toolkit, as in can someone with just the MS toolkit and no access to a copy of Visual Studio itself use vcbuild to compile a Visual Studio...
0
by: Ganapathy | last post by:
I have COM dll code written in VC 6.0. When i tried compiling this code in VC 7, The MIDL cmpiler gets called twice. i.e. it initially compiles fully & immediately a line - 64 bit processing'...
1
by: Marek Krzeminski | last post by:
I followed the instructions in the following link (http://support.microsoft.com/kb/325093/EN-US/) to fix my ASP server and it now works HOWEVER, when I try to use Visual Studio to compile any...
0
by: skip | last post by:
Here's a trivial little Python session which attempts to use compiler.walk (mostly unsuccessfully): % python Python 2.4.2 (#1, Feb 23 2006, 12:48:31) on sunos5 Type "help", "copyright",...
1
by: Efrat Regev | last post by:
Hello, I'm trying to write something that will translate Python code to pseudo-code (for teaching purposes). Googling around indicated that the compiler module is pertinent, especially creating...
31
by: Mark Dufour | last post by:
Hi all, I have recently released version 0.0.20 and 0.0.21 of Shed Skin, an optimizing Python-to-C++ compiler. Shed Skin allows for translation of pure (unmodified), implicitly statically typed...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.