473,656 Members | 2,762 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

LNK2001 Error Using Aggregate __gc Array Initialization With VC.NET 2003

In a module DATA.CPP, when attempting to initialize a __gc array as follows:

//
// Begin sample ...
//

//
// Yes, I include all of the correct assemblies, including MSCORLIB.DLL and
all of
// the other .NET related paraphernalia.
//
Object * swmid = // Trust me, the initializer is correct ...
String * BCSP_PAGE_IS_CH ANGE_AUTHORIZED = S"bcsp_page_is_ change_authoriz ed"
;

OleDbParameter * rcDbParam = // Trust me, the initializer is correct ...

OleDbParameter * retcodeDbParam = // Trust me, the initializer is correct
....
Object * args[] = { BCSP_PAGE_IS_CH ANGE_AUTHORIZED ,
rcDbParam->Value,
retcodeDbParam->Value,
swmid } ;

//
// End sample ...
//

Where each of the variables above are valid and defined in the module, the
code successfully compiles using VC.NET 2003, however, the following link
errors are returned:

Linking...
LINK : warning LNK4075: ignoring '/EDITANDCONTINUE ' due to '/INCREMENTAL:NO'
specification
Data.obj : error LNK2001: unresolved external symbol "unsigned long const
pager::data::$C onstGCArrayBoun d$0xd62a1d3f$1$ "
(?$ConstGCArray Bound$0xd62a1d3 f$1$@data@pager @@3KB)
Debug/RpaClient.exe : fatal error LNK1120: 1 unresolved externals

Such is not the case when the same array is explicitly instantiated and
initialized as follows:

//
// Begin sample ...
//

//
// All of the variable initializers are the same as before, except now the
array
// is explicitly allocated and initialized ...
//

Object * args[] = new Object * [ 4 ] ;
args[ 0 ] = BCSP_PAGE_IS_CH ANGE_AUTHORIZED ;
args[ 1 ] = rcDbParam->Value ;
args[ 2 ] = retcodeDbParam->Value ;
args[ 3 ] = swmid ;

//
// End sample ...
//

The above sample compiles and links without errors or warnings.

Perhaps someone could enlighten me as to the possible cause for the
anomalous behavior?

Perhaps a compiler bug?
Nov 16 '05 #1
0 1233

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

Similar topics

10
763
by: Bil Muh | last post by:
Hello Developers, I use VC++ .NET v2003. By using Windows Forms .NET, I am developing an application which will work with TCP/IP functions. I can Build my application in Debug Mode normally, but, whenever I want to Build at Release Mode, compiler gives LNK2001, LNK2019 ve LNK1120 errors. I read the MSDN documents, unfortunately, I could not solve my problem. I am requesting your help. All errors are below with my application name...
4
5146
by: Chucker | last post by:
Hi Folks, I got an error that drives me crazy because it only occurs sometimes and I can`t even reproduce it. I got a __gc class here is it`s header: #pragma once #include "../empLib/empImg.h"
1
1606
by: Irakli Lomidze | last post by:
Dear Sirs plz Help me I'm Trying compile in C++ .NET 2003 (VS 2003 Enterprise Arcitech) This Code (From MSDN) And Gives LNK2001 Linker Error When i remove "new" operator form constructor all works fine plz help me what happand and how slove this problem This code has no problem in vc++2002 class CppClass {
0
1044
by: Detlef Grittner | last post by:
I created a WinForm App with the wizard for VC++ in VS.net 2003. Then I tried to use a traditional C++ class in this project, i.e. one that has a .h and a .cpp file. I've put a __gc in front of the class, because I want to have it garbage collected. E.g.: ..h:
2
1773
by: Ian Taite | last post by:
Help, I am trying to nail a linking problem, to avoid having to lose about 2 weeks work. I have a backup of my project that compiles and links OK however changes I made sometime since then have resulted in the solution not linking with the error below. The solution comprises of six projects. Five are static library projects which compile ok. The sixth is an EXE than needs to link in the other five .lib files. In the evidence below,...
5
2547
by: rodri rodri via DotNetMonster.com | last post by:
I have done a program with windows forms in "Visual C++". I have implemented a function that returns two values. For example: double functionExample(int parameter, double __gc* result2); And in a header file, I have written this line: using namespace System::Runtime::InteropServices; This line is necessary for key word. But when compiling the project, I get this error:
0
958
by: Allen Maki | last post by:
/* I am trying to practice multidimensional array in a managed class using dynamical allocation. If I tried to compile the following codes, I would get the under mentioned c2440 error message. It is only practice. You may notice that I am not using "private"
6
121891
by: sadegh | last post by:
Hi I have a problem with my program in VC++6 When I compile it, the following errors are listed. I spend a lot of time on the groups.google.com to find its reason, but none of comments could not help me. Does any body know what is the problem?. Thanks. OtherFunctions.obj : error LNK2001: unresolved external symbol "int
0
2698
by: Ryan Gaffuri | last post by:
hlink72@hotmail.com (Eric) wrote in message news:<ab8d8b14.0308220550.54fb5f22@posting.google.com>... LNK1120 is a standard C++ error. you using Visual C++? Means your references a class that doesnt exist or something similiar to that. explanation on microsoft.com its not an oracle specific problem.
0
8297
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8816
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8717
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8498
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7311
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5629
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
1930
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1600
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.