Hi,
Need some help here.
I have a .NET class library in C++ (with CLR).
In this project I have a class with the __nogc keyword. When I use the
new operator within this class's code I receive:
error LNK2001: unresolved external symbol "void * __cdecl operator
new(unsigned int)" (??2@$$FYAPAXI@ Z)
I think I should be able to use unmanaged runtime's new operator from
a .NET project, but I must be doing something wrong. Any ideas ?
BTW: I've referenced mscorlib
Thanks, 3 1058
| ov wrote: Hi, Need some help here. I have a .NET class library in C++ (with CLR). In this project I have a class with the __nogc keyword. When I use the new operator within this class's code I receive: error LNK2001: unresolved external symbol "void * __cdecl operator new(unsigned int)" (??2@$$FYAPAXI@ Z)
I think I should be able to use unmanaged runtime's new operator from a .NET project, but I must be doing something wrong. Any ideas ?
BTW: I've referenced mscorlib
Make you're linking against a version of the CRT. IIRC, for managed apps
you need to use the DLL runtime library (MSVCR70.DLL). You may need to
explicitly add msvcrt.lib to the linker settings.
-cd
Hi, Carl.
I've added msvcrt to both debug and release builds and now everything
works fine. Thanks you.
However, I haven't understood what you meant by: "IIRC, for managed
apps you need to use the DLL runtime library (MSVCR70.DLL)" ?
Thanks, again...
"Carl Daniel [VC++ MVP]" <cp************ *************** **@mvps.org.nos pam> wrote in message news:<Oy******* *******@TK2MSFT NGP12.phx.gbl>. .. | ov wrote: Hi, Need some help here. I have a .NET class library in C++ (with CLR). In this project I have a class with the __nogc keyword. When I use the new operator within this class's code I receive: error LNK2001: unresolved external symbol "void * __cdecl operator new(unsigned int)" (??2@$$FYAPAXI@ Z)
I think I should be able to use unmanaged runtime's new operator from a .NET project, but I must be doing something wrong. Any ideas ?
BTW: I've referenced mscorlib
Make you're linking against a version of the CRT. IIRC, for managed apps you need to use the DLL runtime library (MSVCR70.DLL). You may need to explicitly add msvcrt.lib to the linker settings.
-cd
| ov wrote: Hi, Carl. I've added msvcrt to both debug and release builds and now everything works fine. Thanks you.
However, I haven't understood what you meant by: "IIRC, for managed apps you need to use the DLL runtime library (MSVCR70.DLL)" ?
When you add msvcrt.lib to the link, you're using the DLL runtime library -
msvcrt.lib is an "import library" and simply serves to make associations
between your EXE and the DLL runtime library, which is named MSVCR71.DLL if
you're using VS.NET 2003. (MSVCR70.DLL if you're using VS.NET 2002).
-cd This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: qazmlp |
last post by:
const has internal linkage in C++, but external linkage in C.
Am I right ?
But, linker reports multiply-defined error if the
following header is included in multiple .cpp files.
// test_const.h
#ifndef HEADER_TEST
#define HEADER_TEST
|
by: usr2003 |
last post by:
I wrote the following test program to test the linkage directives
extern "C":
#include <stdio.h>
extern "C" {
|
by: Richard Hayden |
last post by:
Hi,
I have the following code:
/******************************** file1.c
#include <iostream>
extern void dummy();
inline int testfunc() {
|
by: Jeff |
last post by:
In the function below, can size ever be 0 (zero)?
char *clc_strdup(const char * CLC_RESTRICT s)
{
size_t size;
char *p;
clc_assert_not_null(clc_strdup, s);
size = strlen(s) + 1;
|
by: amirr |
last post by:
Guys,
As you know static member functions do not have a this pointer. so
instead, what shall i do?
for example ... consider I want to call
Code: ( text )
1.
| |
by: CrazyJohn |
last post by:
Hi guys,
This is my first time posting question here, if I break any rules,
please kindly point out. And I'm really glad to be a part of this
community.
Here is my question,
Our lecturer told us that Unnamed Namespace is an alternative to
Static Internal Variables, but he also said that Namespace has an
|
by: Kurt |
last post by:
The C++ standard (in 3.5:6, p42Example) said:
static int i = 0; //
1
void g()
{
int i; //2: i has no linkage
{
extern int i; //3: external linkage
|
by: Bryan Parkoff |
last post by:
I write my large project in C++ source code. My C++ source code
contains approximate four thousand small functions. Most of them are
inline. I define variables and functions in the global scope. The global
variables and global functions are hidden to prevent from accessing by the
programmers. All global functions share global variables....
|
by: shuisheng |
last post by:
Dear All,
I am always confused in using constants in multiple files.
For global constants, I got some clues from
http://msdn.microsoft.com/en-us/library/0d45ty2d(VS.80).aspx
So in header file writing: const double PI = 3.14;
Every time using it, include the header file.
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
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. ...
| |
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...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |