标签: linker-errors

提升lib链接器错误Visual C++

我下载的源Launchy,我试图建立它在Visual Studio 2005中Launchy项目使用VC7内置,所以我不得不更新项目文件VC8和过程似乎进展顺利.然而,Launchy也使用了Boost 1.33.1库,而我构建的是Boost 1.41.0库(Boost的道具,使更新的库更容易构建),所以我也更新了项目以指向我的新提升库安装.现在我收到以下链接器错误:

fatal error LNK1104: cannot open file 'libboost_regex-vc80-mt-sgd-1_41.lib'
Run Code Online (Sandbox Code Playgroud)

我查看了Boost lib目录,我能找到的最接近的匹配是......

libboost_regex-vc80-mt-gd-1_41.lib
Run Code Online (Sandbox Code Playgroud)

注意缺少的's'.我不明白libs的区别是什么,以及Visual Studio是否正在寻找错误的东西,或者我的Boost构建过程是否无法构建正确的库.任何人都能指出我正确的方向吗?

作为一个实验,我制作了我所拥有的正则表达式lib的副本,并将其重命名为链接器正在寻找的内容.这给了我很长的关于已经在msvcrtd.lib中定义的符号的链接器错误列表,如下所示:

error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in libcmtd.lib(typinfo.obj)
Run Code Online (Sandbox Code Playgroud)

我将尝试构建Boost 1.33.1库并指向我的Launchy项目文件.但是我仍然想知道我的Boost 1.41.0库有什么问题.

编辑:我在Boost文档中找到了's'库的参考:

静态链接到C++标准库和编译器运行时支持库时,请使用此库.

所以看起来's'的库是正确的.现在我只需要弄清楚如何构建它们.

解决方案:我能够使用以下命令行构建缺少的升级库.

bjam --build-type=complete msvc stage
Run Code Online (Sandbox Code Playgroud)

我已经在升力生活的目录中运行了boostrap.bat之后运行了.

c++ boost visual-studio-2005 linker-errors

6
推荐指数
1
解决办法
7595
查看次数

为什么我的C程序中的ws2_32.dll会出现链接器错误?

我在Visual Studio 2010中编写程序.我无法链接ws2_32.dll以我的项目命名的文件.

谁能告诉我怎么做到这一点?

c winapi linker-errors winsock2 visual-studio

6
推荐指数
3
解决办法
1万
查看次数

OpenGL/glut/stdc ++构建错误

我正在使用Ubuntu并尝试使用synaptic安装其中包含"GLUT"一词的所有内容以及SDL和opengl.但仍然是一个简单的程序无法编译.它显示了这个:

opengl1.cpp:(.text+0xe): undefined reference to `glClear'
opengl1.cpp:(.text+0x1a): undefined reference to `glBegin'
opengl1.cpp:(.text+0x2e): undefined reference to `glVertex2i'
opengl1.cpp:(.text+0x33): undefined reference to `glEnd'
opengl1.cpp:(.text+0x38): undefined reference to `glFlush'
/tmp/ccnwQeLu.o: In function `MyInit()':
opengl1.cpp:(.text+0x4c): undefined reference to `glGetString'
opengl1.cpp:(.text+0x57): undefined reference to `std::cout'
opengl1.cpp:(.text+0x5c): undefined reference to `std::basic_ostream >& std::operator >(std::basic_ostream >&, unsigned char const*)'
opengl1.cpp:(.text+0x6c): undefined reference to `std::basic_ostream >& std::operator >(std::basic_ostream >&, char const*)'
opengl1.cpp:(.text+0x78): undefined reference to `glGetString'
opengl1.cpp:(.text+0x83): undefined reference to `std::cout'
opengl1.cpp:(.text+0x88): undefined reference to `std::basic_ostream >& std::operator …

c++ opengl glut linker-errors

6
推荐指数
1
解决办法
1万
查看次数

LNK2022和LNK2034链接器错误与CRT版本10.0

很抱歉打扰这个问题的人,但我已经研究了几个小时了,还没有决议:

我正在将一个相当庞大的应用程序移植到Visual Studio 2010中的10.0 CRT(编译器).该应用程序是使用/ clr管理的C++/CLI.大多数代码都是本机代码(95%),其中包含一些托管部分.

所以我的工作是将.vcxproj中的开关定位到较新的10.0 CRT(即编译器).我们以前使用的是v90,或者使用VS 2008 SP1附带的VC编译器.

好的,这么重大变化?实际上看起来像一堆.我修复了一些处理集合的迭代器问题,这一切都非常简单.

但这些链接器错误正在扼杀我.任何帮助,将不胜感激:

1>MSVCMRTD.lib(locale0_implib.obj) : error LNK2022: metadata operation failed (80131195) : Custom attributes are not consistent: (0x0c0001c0).
1>MSVCMRTD.lib(locale0_implib.obj) : error LNK2022: metadata operation failed (80131195) : Custom attributes are not consistent: (0x0c0001c5).
...

1>MSVCMRTD.lib(locale0_implib.obj) : error LNK2034: metadata inconsistent with COFF symbol table: symbol '??0?$allocator@D@std@@$$FQAE@ABV01@@Z' (06000141) has inconsistent metadata with (0A000F75) in identity.obj
1>MSVCMRTD.lib(locale0_implib.obj) : error LNK2034: metadata inconsistent with COFF symbol table: symbol '??0?$allocator@D@std@@$$FQAE@ABV01@@Z' (06000141) has inconsistent metadata with …
Run Code Online (Sandbox Code Playgroud)

windows winapi stl linker-errors visual-studio-2010

6
推荐指数
1
解决办法
7396
查看次数

如何避免头文件中定义的变量的LNK2005链接器错误?

我有3个cpp文件,看起来像这样

#include "Variables.h"
void AppMain() {
    //Stuff...
}
Run Code Online (Sandbox Code Playgroud)

他们都在里面使用相同的变量,所以他们有相同的标题,但我得到这样的东西

1>OnTimer.obj : error LNK2005: "int slider" (?slider@@3HA) already defined in AppMain.obj
Run Code Online (Sandbox Code Playgroud)

这是为什么?

c++ header include linker-errors

6
推荐指数
1
解决办法
3万
查看次数

Visual Studio错误:LNK1104:无法打开文件'kernel32.lib' - 仅在WP8项目/ Win32版本中

我最近遇到了这个问题(前几天一切正常):Visual Studio 2012开始拒绝构建原生WP8项目.

今天,我从模板'Windows Phone Direct3D App(Native Only)'创建了新的解决方案,以检查我是否在WP上正确支持我新创建的DLL.我尝试编译这个项目,首先没有任何更改或额外的引用 - 由VS生成的纯代码.但是,它因给定错误而失败.我非常清楚这是什么意思,可能的原因是什么,但我无法理解,在这种情况下它来自何处.奇怪的是:这只发生在'Win32'配置中,ARM编译很好:

1>------ Build started: Project: PhoneDirect3DApp, Configuration: Debug ARM ------
.......

Build Summary
-------------
00:11.742 - Success - Debug ARM - PhoneDirect3DApp\PhoneDirect3DApp.vcxproj
Run Code Online (Sandbox Code Playgroud)

但Win32没有:

1>------ Build started: Project: PhoneDirect3DApp, Configuration: Debug Win32 ------
.......
1>LINK : fatal error LNK1104: cannot open file 'kernel32.lib'

Build Summary
-------------
00:09.725 - Failed  - Debug Win32 - PhoneDirect3DApp\PhoneDirect3DApp.vcxproj
Run Code Online (Sandbox Code Playgroud)

我的标准(本机C++/Win32)项目也按预期工作(在Win32和x64平台目标中).

项目配置:(在两个平台中)

链接::输入:

d3d11.lib;%(AdditionalDependencies)
Run Code Online (Sandbox Code Playgroud)

链接::忽略:

ole32.lib;%(IgnoreSpecificDefaultLibraries)
Run Code Online (Sandbox Code Playgroud)

VC++目录:

Microsoft.ARM.Cpp.User:

$(WP80ToolSetPath)lib\arm;$(WindowsSDK_LibraryPath_ARM);
Run Code Online (Sandbox Code Playgroud)

Microsoft.Win32.Cpp.User:

$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WP80ToolSetPath)lib\x86;$(WindowsSDK_LibraryPath_x86)
Run Code Online (Sandbox Code Playgroud)

有什么想法可能是错误的或错误配置?我的想法已经不多了,我以前从未见过这样的东西.

顺便说一句,我注意到了另一个变化:当我尝试在ARM配置中编译WP8项目时,总是出现错误,说"不支持在桌面上构建ARM应用程序"(或类似的东西).现在ARM编译没有问题.这是正常的吗?

c++ linker-errors visual-studio-2012 windows-phone-8 windows-phone-8-sdk

6
推荐指数
1
解决办法
3万
查看次数

无法编译OpenGL Superbible 7th(未解析的外部符号)的样本

我正在按照步骤进行操作HOWTOBUILD.txt.我已经为glfw构建了必要的文件.链接器第一次抱怨glfw.搜索后,似乎我需要链接反对gl3w 看到这个链接.我为它生成了静态库gl3w.现在,我已经开了一个新项目并包含了路径include,见下图.

在此输入图像描述

对于链接器,我已经链接glfw3dll.lib gl3w.lib opengl32.lib并包含它们的路径.如果我从第一章开始运行样本,

main.cpp

#include "sb7.h"


class my_application : public sb7::application
{
    void render(double currentTime)
    {
        static const GLfloat red[] = { 1.0f, 0.0f, 0.0f, 1.0f };
        glClearBufferfv(GL_COLOR, 0, red);
    }
};


DECLARE_MAIN(my_application);
Run Code Online (Sandbox Code Playgroud)

我收到链接器错误.

1>main.obj : error LNK2019: unresolved external symbol "int __cdecl sb6IsExtensionSupported(char const *)" (?sb6IsExtensionSupported@@YAHPBD@Z) referenced in function "public: virtual void __thiscall sb7::application::run(class sb7::application *)" (?run@application@sb7@@UAEXPAV12@@Z)
1>main.obj : error LNK2019: unresolved external symbol "private: static void …
Run Code Online (Sandbox Code Playgroud)

c++ windows linker-errors opengl-4

6
推荐指数
1
解决办法
3193
查看次数

未定义的引用'__divdi3'

在链接一些对类型long longI 的整数执行除法和模运算的代码时,会收到以下两个错误:

util.c:(.text+0x1af): undefined reference to '__divdi3'
util.c:(.text+0x1ef): undefined reference to '__moddi3'
Run Code Online (Sandbox Code Playgroud)

我也试过使用unsigned long long,但是会导致以下错误:

util.c:(.text+0x1af): undefined reference to '__udivdi3'
util.c:(.text+0x1ef): undefined reference to '__umoddi3'
Run Code Online (Sandbox Code Playgroud)

更换long longintlong解决问题,但我需要使用unsigned long long.

我使用以下命令行来编译和链接程序:

gcc -ffreestanding -c kernel/util.c -o kernel/util.o
ld -o kernel32.bin -Ttext 0x500 kernel/util.o kernel/kernel.o --oformat binary
Run Code Online (Sandbox Code Playgroud)

这是功能:

char* itoa(unsigned long long i, char b[]){
    if (i == 0){
        b[0] = '0';
        b[1] = '\0';
        return b;
    }
    char …
Run Code Online (Sandbox Code Playgroud)

c linker compiler-errors linker-errors

6
推荐指数
1
解决办法
8908
查看次数

奇怪的"未定义引用"错误

所以我试图在使用C的Windows API上创建一个非常简单的抽象库.我制作了一个简单的Makefile,当我尝试使用Msys制作项目时,我得到了这个:

winapi.o: In function `get_client_pid':
(long path)/winapi.c:13: undefined reference to `GetExtendedTcpTable'
(long path)/winapi.c:31: undefined reference to `GetExtendedTcpTable'
collect2.exe: error: ld returned 1 exit status
make: *** [lib] Error 1
Run Code Online (Sandbox Code Playgroud)

和get_client_pid()在winapi.c中定义为

#include <stdint.h>
#include <stdio.h>
#include <windows.h>
#include <Iphlpapi.h>

#define true 1
#define false 0


    uint32_t get_client_pid()
    {
        MIB_TCPTABLE_OWNER_PID *tcpTable;
        PDWORD tableSize;
        DWORD ret = GetExtendedTcpTable(tcpTable, 
                                        tableSize, 
                                        true, 
                                        2, 
                                        TCP_TABLE_OWNER_PID_ALL,
                                        0);

        if (ret == NO_ERROR) {
            printf("ERROR get_client_pid: No error with table size at 0?\n");
            return 0;
        }
        if (ret …
Run Code Online (Sandbox Code Playgroud)

c makefile linker-errors

6
推荐指数
1
解决办法
183
查看次数

无法生成位码束,因为在没有完整位码的情况下构建了“ PermissionScope.framework”

PermissionScope.framework在项目中添加了此文件,并尝试将其归档,但显示以下错误。

无法生成位码捆绑包,因为构建的“ AppPath /PermissionScope.framework/PermissionScope”没有完整的位码。必须从Xcode Archive生成所有用于位代码的框架和dylib或为体系结构arm64 clang安装生成:错误:链接器命令失败,退出代码为1(使用-v查看调用)

请帮助我解决此问题。

iphone linker-errors ios bitcode swift3.0.2

6
推荐指数
0
解决办法
973
查看次数