c++ - 函数引用FuncName@Number,@X是什么意思?

标签 c++ compilation

我最近使用 WinSock 编写代码,当我尝试调用 WSAStartup 时,编译器抛出了这个错误:

undefined reference to `WSAStartup@8'

我以前处理过这类问题,它们没什么大不了的,我一定是漏掉了定义什么的。但是,此线程针对不同的主题:@8 是什么意思?

如果你试图在没有 main 函数的情况下编译一个文件,它会抛出:

undefined reference to `WinMain@16'

同样,臭名昭著的@Number。我试图在网上查找它,但老实说我不知道​​从哪里开始,因为我最终得到的只是编译器错误的解决方案,与@16、@8 或@X 的起源无关。

我一直想知道的另一件事是引号是怎么回事:

`something'

为什么开头的引语和结尾的不同?首先使用反引号 ( ` ) 有什么意义?

最佳答案

数字是它的函数参数的字节。

来自 MSDN :

For __stdcall functions, names include the "@" character and a decimal number that specifies the number of bytes in its function parameters. For example, the decorated name of the LoadLibrary function is LoadLibrary@4. For C++ functions the name decoration is more complex and varies from compiler to compiler.

关于c++ - 函数引用FuncName@Number,@X是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42757613/

相关文章:

c++ - 使用 SDL 的硬件缓冲,关于它如何工作的问题

c++ - GCC/G++ 编译器设置 GUI

编译头文件

使用 makefile 编译 C 项目

linux - 打补丁后的内核编译

c++ - 我可以使用从左到右的样式和 `auto` 来声明原始指针吗?

c++ - 获取指向包含十六进制值的 C 字符串的指针

c++ - 如何从 GLSL 程序中获取 uvec4 输出

使用 gcc 编译包括 .h 文件?

python - “Indentation Error: unindent does not match any outer indentation level”问题