473,405 Members | 2,444 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,405 software developers and data experts.

LIBCD.lib(crt0.obj) : error LNK2019: unresolved external symbol _main


I am quite experienced with vs.net 2003 and c# but fairly new to c++. I
have a test app in c++ that I need to compile for a c#/c++ interop
evaluation I'm doing.

But first, I simply need to compile some straightforward, non-managed,
console based c++ code. I created a win32 console c++ project. Then I
added several "existing" c++ .cpp and .h files. When I try to compile, I
get this error...

LIBCD.lib(crt0.obj) : error LNK2019: unresolved external symbol _main
referenced in function _mainCRTStartup

Debug/player-cpp-only.exe : fatal error LNK1120: 1 unresolved externals

My player-cpp-only.cpp file contains "main()". The error above leads me to
believe something is going wrong in or near the file containing main(), so I
have included the contents of that file below.

Recommendations for debugging will be greatly appreciated.

Thanks, Bruce

// player-cpp-only.cpp

#include "player.h"

namespace nsPlayer

{

int main()

{

Player player( "Test Player", false );

DiskCollection disks( "disks.dat", "Bruce's Disk Collection" );

player.attachAC(true);

return 0;

}

}
Nov 17 '05 #1
8 13662
I suspect your namespace makes your main COMDAT something like...

?main@nsPlayer@@YAHXZ

....whereas _mainCRTStartup is looking for...

_main

....I bet if you take it out of the namespace it'll work, but if you still
have problems, you probably need to redeclare it as...

extern "C" int main()

--
Jeff Partch [VC++ MVP]
Nov 17 '05 #2
Hi Bruce,

Do you have tried Jeff's suggestion?
Keep the information coming!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
Nov 17 '05 #3
Gary and Jeff,
I found a problem in my config of vs.net and things are up and running
again.
Thanks!
- Bruce

"Gary Chang" <v-******@online.microsoft.com> wrote in message
news:uM**************@tk2msftngp13.phx.gbl...
Hi Bruce,

Do you have tried Jeff's suggestion?
Keep the information coming!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights. --------------------

Nov 17 '05 #4

Bruce Schechter wrote:
[b]Gary and Jeff,
I found a problem in my config of vs.net and things are up an
running
again.
Thanks!
- Bruce

Hi Bruce,

I'm having similar trouble in vs.net. Do you remember what you di
to fix the problem with the coniguration? I'd appreciate any help.

- Wyat

-
Wyatt Lindse
-----------------------------------------------------------------------
Posted via http://www.mcse.m
-----------------------------------------------------------------------
View this thread: http://www.mcse.ms/message754971.htm

Nov 17 '05 #5

hi,
im having the same problem
when i try to compile my code it will give me error
my code is:

int main()
{
int i;
i=6;
return(0);
}

and error:

--------------------Configuration: kolmas - Win3
Debug--------------------
Compiling...
kolmas.cpp
Linking...
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbo
_WinMain@16
Debug/kolmas.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

kolmas.exe - 2 error(s), 0 warning(s)

can you please help me
i cant compile my code, i have this error since i installed allegr
librar
-
stiiv8
-----------------------------------------------------------------------
Posted via http://www.mcse.m
-----------------------------------------------------------------------
View this thread: http://www.mcse.ms/message754971.htm

Nov 17 '05 #6
"stiiv86" <st************@mail.mcse.ms> wrote in message
news:st************@mail.mcse.ms...
--------------------Configuration: kolmas - Win32
Debug--------------------
Compiling...
kolmas.cpp
Linking...
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol
_WinMain@16
Debug/kolmas.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

kolmas.exe - 2 error(s), 0 warning(s)

can you please help me
i cant compile my code, i have this error since i installed allegro
library


Windowed applications on Win32 begin at WinMain() while character mode
applications begin at main(). Apparently you have mistakenly created a
Windowed project with console application code.

Regards,
Will
Nov 17 '05 #7

thank you for your help,
i'm quite new to C++
now it works :
-
stiiv8
-----------------------------------------------------------------------
Posted via http://www.mcse.m
-----------------------------------------------------------------------
View this thread: http://www.mcse.ms/message754971.htm

Nov 17 '05 #8

Hi,

I am getting the same error, but with an ATL-based COM project. As fa
as I know it doesn't have a main(). So what is going on? Any help woul
be appreciated.

Royc
-
RFicklin
-----------------------------------------------------------------------
Posted via http://www.mcse.m
-----------------------------------------------------------------------
View this thread: http://www.mcse.ms/message754971.htm

Nov 17 '05 #9

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

Similar topics

6
by: Uli | last post by:
Hello, I'm trying to use a DLL (by static linking) which was compiled with Borland C++Builder (BCB) in Visual C++ (Visual-Studio 2003). All functions are declared with the directive 'extern...
1
by: Julian | last post by:
I am trying to compile a "legacy" code in VC++ .NET (2003) this code works fine in VC6 I get the following error: LNK1104: cannot open file 'msvcirtd.lib' i read this page :...
1
by: Danno040 | last post by:
I'm trying to compile the source code for the demos that comes with NVIDIA's SDK using Visual Studio 2005, however whenever I try to build them I get a large number of unresolved external errors or...
2
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: ...
1
by: bhushan11 | last post by:
hello sir i am searching in your site but i dont get how to place question about visual c++. so i am post this vc++ question in .net , sorre about that i am working on visual c++ lang. but i...
8
by: hadimani | last post by:
Hi i am getting error LNK2001: unresolved external symbol_function name where these functions are called in the main function.
3
by: walex | last post by:
Hello guys, I'm trying to install devsec an application for ffpeg for camera,but on,is a c programme,after compilation ,i now type make, then this two error are generated.common.h:67: error: array...
2
by: bcoder77 | last post by:
Hi All, I am using Rhapsody7.0 in C++ with Miscrosoft Visual Studio 9.0. I wrote a simple "Hello World" project and while running (GMR) the project I get this error: Building ------------ ...
4
by: =?Utf-8?B?amM=?= | last post by:
Hello, I am in process of porting a 32-bit app to a 64-bit app. The 32-bit app compiles/links and executes OK using the CPUInfo.lib. However, when I compile/link the 64-bit app I get several...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.