当前位置:网站首页>_ HUGE and __ IMP__ HUGE in “math.h“
_ HUGE and __ IMP__ HUGE in “math.h“
2022-07-28 10:52:00 【vv1025】
I have a question about how constants defined in math.h are linked.
In visual studio 2010, I'm building a 64-bit dll c++ library with "MD" that uses a third party library that make use of "HUGE_VAL". From the header "math.h", it seems that "HUGE_VAL" is defined as "_HUGE". When I try to build, a linking error results
error LNK2001: unresolved external symbol _HUGE
After doing some googling, I think _HUGE should be defined in msvcrt.lib. MSVCRT.lib is linked, but I didn't link libcmt.lib because it would cause re-definition errors.
What strikes me as odd is that when I create a simple console program that uses HUGE_VAL and use /verbose as a linker option, it shows _IMP_HUGE being linked.
What I'm really curious of is at what stage does _HUGE turn into _IMP_HUGE? Also, have anyone else gotten the unresolved _HUGE error and does anyone have any ideas for how it could be fixed?
Thanks for reading the long question and for any ideas.I have experienced this issue with VC11.0. The only error I get is an unresolved symbol _HUGE error.
I am linking with dynamic multi-threaded run time libraries and I found that if I were to include "libcmt.lib" in my link step, then the issue is resolved (or worked around).
I started looking into how the headers were defined in the SDK for clues and found that I was missing a compiler pre-directory in my compile steps: _DLL.
When you build with dynamic run time libraries the _HUGE variable needs to be __declspec(dllimport) so it can be found. When you include "math.h" -> "crtdefs.h" without setting _DLL as a pre-directive, the variable will not be __declspec(dllimport)'ed and will appear missing at link time.
I was getting this issue because I am compiling with my own custom makefiles and I had neglected to add the _DLL pre-directive. Adding -D_DLL to my compilation step resolved the compile issue with no other changes needed.
I know this thread is old, but figured I would throw it out there as it may help someone with a similar issue.
Share
Improve this answer
Follow
answered Aug 22 '13 at 0:41LIBCD.lib
LIBC.lib
LIBCMT.lib边栏推荐
- Pat grade a title in September 2019
- 7、MapReduce自定义排序实现
- GKNoiseSource
- If you don't climb mountains, you don't know the height of the sky; If you don't face deep streams, you don't know the thickness of the earth
- Start from scratch blazor server (2) -- consolidate databases
- 蓝桥杯嵌入式-HAL库-SYSTICK
- 生成对抗网络在DeepFake中的未来
- OCR 知识 概括
- Markdown to word or PDF
- GKObstacle
猜你喜欢

Pyqt5 rapid development and practice 4.13 menu bar, toolbar and status bar and 4.14 qprinter

PyQt5快速开发与实战 4.13 菜单栏、工具栏与状态栏 and 4.14 QPrinter

蓝桥杯嵌入式-HAL库-SYSTICK

Batch Normlization

Solving the optimal solution of particle swarm optimization

SQL Server 2016 learning record - nested query

ICML 2022 | 图表示学习的结构感知Transformer模型

The future of generating confrontation networks in deepfake

Blue Bridge Cup embedded Hal library ADC

Machine learning -- handwritten English alphabet 1 -- classification process
随机推荐
FHWY工作日进度表
7. MapReduce custom sorting implementation
C language input string with spaces
RoboCup (2D) experiment 50 questions and the meaning of main functions
Go memory model (version on May 31st, 2014)
Batch Normlization
nodejs:检测并安装npm模块,如果已安装则跳过
GKCircleObstacle
GKNoiseMap
5、Window端实现Mapreduce程序完成wordcount功能
c语言进阶篇:指针(一)
10_ue4进阶_添加倒地和施法动作
10_ UE4 advanced_ Add fall and cast actions
生成对抗网络在DeepFake中的未来
Install MySQL based on docker
Excel word 简单 技巧 整理(持续更新 大概~)
ICML 2022 | graph represents the structure aware transformer model of learning
11_ue4进阶_男性角色换成女性角色,并修改动画
Tensorflow 知识点
GKLinearCongruentialRandomSource