我的项目是使用旧版本的Boost的iostreams w/bzip2.我现在正在尝试升级到Boost 1.51.起初我没有用bzip编译,所以很明显我让链接器大喊大叫libboost_bzip2-vc100-mt-sgd-1_51.lib丢失了.然后我按照这些说明(并添加了静态标志)来编译该文件.
但是,运行链接器现在会返回一堆缺少的符号:
>error LNK2001: unresolved external symbol "protected: __thiscall boost::iostreams::detail::bzip2_base::~bzip2_base(void)" (??1bzip2_base@detail@iostreams@boost@@IAE@XZ)
>error LNK2001: unresolved external symbol "protected: __thiscall boost::iostreams::detail::bzip2_base::bzip2_base(struct boost::iostreams::bzip2_params const &)" (??0bzip2_base@detail@iostreams@boost@@IAE@ABUbzip2_params@23@@Z)
>error LNK2001: unresolved external symbol "int const boost::iostreams::bzip2::stream_end" (?stream_end@bzip2@iostreams@boost@@3HB)
...
任何想法如何来lib不包含所有这些代码?我错过了什么?我在Windows上使用VS2010.
编辑:知道了!
有一个没有bzip编译的旧版libboost_iostreams-vc100-mt-sgd-1_51.lib.我仍然不确定的是:我使用的原始编译:
>b2 --with-iostreams -sBZIP2_SOURCE=D:\Work\external\bzip2-1.0.6 -sZLIB_SOURCE=d:\work\external\zlib-1.2.3 runtime-link=static
这产生了以下文件:
libboost_bzip2-vc100-mt-s-1_51.lib
libboost_bzip2-vc100-mt-sgd-1_51.lib
对于"正确的"编译(解决了问题),我使用了:
>b2 --with-iostreams -sBZIP2_SOURCE=D:\Work\external\bzip2-1.0.6 runtime-link=static
即只是删除了zlib,因为它对我来说是不必要的.它产生了:
libboost_bzip2-vc100-mt-s-1_51.lib
libboost_bzip2-vc100-mt-sgd-1_51.lib
libboost_iostreams-vc100-mt-s-1_51.lib
libboost_iostreams-vc100-mt-sgd-1_51.lib
为什么没有在原始编译中生成iostreams库?很奇怪.
谢谢.
我在SDI(启用Doc/View的)项目中写了一些带有几个标准对话框的porgram.
现在,我想把它发送给一些朋友,我确实设置了Use of MFC Use MFC in a static library.
但是当我尝试构建解决方案时,我收到以下错误:
错误LNK2001:未解析的外部符号_IID_IWICImagingFactory
我的问题是,我不知道这个接口id到底是什么,因为我没有手动编写任何COM代码或使用任何图像工厂的东西或相等...
我有点迷失了...
任何人都可以告诉我如何解决这个问题并使其与静态MFC使用一起工作?
提前致谢!
c++ mfc visual-studio-2010 unresolved-external visual-studio
我正在Ubuntu 14.04(64位)编译深度学习库Caffe.
Version: 2.4.8+dfsg1-2ubuntu1从ubuntu软件包服务器安装OpenCV():
sudo apt-get install libopencv-dev
Caffe使用CMake 2.8 编译.
链接错误:
链接CXX可执行文件
/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8:未定义引用`TIFFOpen@LIBTIFF_4.0'
似乎找不到TIFF库的一些符号.我努力找到原因(没有运气).这是关于库的一些信息.
TIFF库链接 libopencv_highgui.so.2.4.8
$ ldd libopencv_highgui.so.2.4.8 | grep tiff
libtiff.so.5 => /usr/lib/x86_64-linux-gnu/libtiff.so.5(0x00007f978313b000)
导入符号 libopencv_highgui.so.2.4.8
$ readelf -s libopencv_highgui.so.2.4.8 | grep TIFFOpen
62:0000000000000000 0 FUNC GLOBAL DEFAULT UND TIFFOpen@LIBTIFF_4.0(9)
注意:@符号名称中只有一个.
$ nm -D libopencv_highgui.so.2.4.8 | grep TIFFOpen
你TIFFOpen
出口符号libtiff.so.5:
$ nm -D /usr/lib/x86_64-linux-gnu/libtiff.so.5
0000000000000000 A LIBTIFF_4.0
...
00000000000429f0 T TIFFOpen
...
$ readelf -s /usr/lib/x86_64-linux-gnu/libtiff.so.5|grep TIFFOpen …
如何修复Visual Studio 2012错误LNK2019:未解析的外部符号"__declspec(dllimport)public:class std :: basic_string?
我一直在编译一个包含一个exe和几个静态lib项目的解决方案,其中exe依赖于Visual Studio 2008.静态库包括:
我将解决方案加载到Visual Studio 2012中并编译了解决方案中的所有项目,但是当我尝试链接exe时,我在标准C++库中收到有关未解析符号的错误,如下面的输出.
我发现很多人都有像这样的未解决的符号,但没有一个修复对我有效.到目前为止我尝试过的修复包括
Visual Studio 2012链接器的输出...
 1>ace_funcs.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:LBR' specification
 1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
 1>ComponentX-Win32.lib(MyOrgConsoleSktServer.obj) : warning LNK4049: locally defined symbol ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)) imported
 1>ComponentY-Win32.lib(ORBSingleton.obj) : warning LNK4049: locally defined symbol …stdstring unresolved-external lnk2019 c++-standard-library visual-studio-2012
我正在使用CUDA,我已经创建了一个int2_类来处理复数整数.
ComplexTypes.h文件中的类声明如下:
namespace LibraryNameSpace
{
    class int2_ {
        public:
            int x;
            int y;
            // Constructors
            __host__ __device__ int2_(const int,const int);
            __host__ __device__ int2_();
            // etc.
            // Equalities with other types      
            __host__ __device__ const int2_& operator=(const int);
            __host__ __device__ const int2_& operator=(const float);
            // etc.
    };
}
ComplexTypes.cpp文件中的类实现如下:
#include "ComplexTypes.h"
__host__ __device__         LibraryNameSpace::int2_::int2_(const int x_,const int y_)           { x=x_; y=y_;}
__host__ __device__         LibraryNameSpace::int2_::int2_() {}
// etc.
__host__ __device__ const   LibraryNameSpace::int2_& LibraryNameSpace::int2_::operator=(const int a)                        { x = a; …所以我得到以下错误:
1>SDL2main.lib(SDL_windows_main.obj) : error LNK2019: unresolved external symbol __imp__fprintf referenced in function _ShowError
1>SDL2main.lib(SDL_windows_main.obj) : error LNK2019: unresolved external symbol __imp____iob_func referenced in function _ShowError
我的代码很简单:
#include <iostream>
#include "SDL2\SDL.h"
int main(int argc, char* argv[])
{
    std::cout << "Hello World!" << std::endl;
    return 0;
}
我已正确链接库,这在vs2012中工作正常,但由于某种原因不能在vs2015中编译.
升级Android Studio后,一个没有问题的项目开始在编辑器中显示问题.我有很多Unresolved Reference错误.支持库下的任何内容(support-v4,support-v7).
在上面的屏幕截图中,任何显示为红色的内容都不会解析并显示为错误.我也在使用Lifecycle组件和Room数据库.他们似乎也有问题.看起来可以找到接口,但类不能.
例如,在我的一个班级中使用Room,
android.arch.persistence.room.Database并android.arch.persistence.room.TypeConverters正确解决,但是
android.arch.persistence.room.Room并且android.arch.persistence.room.RoomDatabase不.
注意:该项目在Android模拟器和设备上构建并运行良好,没有任何问题.它使用Android Studio上的构建按钮构建和运行,没有任何错误.我没有收到任何Class not found错误.这只是Android Studio编辑器中的一个问题.我已经重新启动了Android Studio,清理并重建了项目.
这是我的项目构建文件:
buildscript {
  ext.kotlin_version = '1.2.70'
  ext.serialization_version = '0.6.2'
  ext.gradle_plugin_version = '3.2.0'
  repositories {
    google()
    jcenter()
    maven { url "https://jitpack.io" }
    maven { url "https://kotlin.bintray.com/kotlinx" }
  }
  dependencies {
    classpath "com.android.tools.build:gradle:3.2.1"
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    classpath "org.jetbrains.kotlinx:kotlinx-gradle-serialization-plugin:$serialization_version"
  }
}
allprojects {
  repositories {
    google()
    jcenter()
    maven { url 'https://jitpack.io' }
    maven { url "https://kotlin.bintray.com/kotlinx" }
  }
}
task clean(type: …我想在Visual Studio 2010中的相同解决方案中构建两个可以相互交互的C++项目.我在目录下创建了一个解决方案C:\Users\me\Desktop\SolutionDir.这两个项目分别在C:\Users\me\Desktop\SolutionDir\FirstProject和下创建C:\Users\me\Desktop\SolutionDir\SecondProject.
我的第一个项目包含两个文件,一个标题function.h和一个cpp文件function.cpp
#pragma once
void print_stuff();
#include "function.h"
#include <iostream>
void print_stuff() {
    std::cout << "hello world" << std::endl;
}  
我的第二个项目包含主文件 main.cpp
#include "FirstProject\function.h"
#include <iostream>
int main(void) {
    print_stuff();
    int stop;
    std::cin >> stop;
    return 0;
}  
我C:\Users\me\Desktop\SolutionDir\在SecondProject中添加了目录Configuration Properties > C/C++ > General > Additional Include Directories.我仍然得到经典错误:error LNK2019: unresolved external symbol调用函数时print_stuff().
有任何想法吗 ?
c++ include visual-studio-2010 unresolved-external multiple-projects
我遇到了glew和链接器错误的问题.我有:
但是,我仍然收到以下错误:
1>project2.obj : error LNK2001: unresolved external symbol ___glewGetProgramInfoLog
1>project2.obj : error LNK2001: unresolved external symbol ___glewGetShaderInfoLog
1>project2.obj : error LNK2001: unresolved external symbol ___glewGetProgramiv
1>project2.obj : error LNK2001: unresolved external symbol ___glewGetShaderiv
1>project2.obj : error LNK2001: unresolved external symbol ___glewIsShader
1>project2.obj : error LNK2001: unresolved external symbol ___glewGetUniformLocation
1>project2.obj : error LNK2001: unresolved external symbol ___glewLinkProgram
1>project2.obj : error LNK2001: unresolved external symbol ___glewAttachShader
1>project2.obj : error LNK2001: unresolved external symbol ___glewCreateProgram
1>project2.obj …我在CentOS 7上使用Devtoolset-7并且已经构建了Boost 1.65.1 w/it.但是当我链接我的应用程序时,我有以下内容:
/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld: /opt/rh/devtoolset-7/root/usr/lib64/libboost_unit_test_framework.a(compiler_log_formatter.o)(.text._ZN5boost9unit_test5utils11string_castINS0_13basic_cstringIKcEEEESsRKT_[_ZN5boost9unit_test5utils11string_castINS0_13basic_cstringIKcEEEESsRKT_]+0x3c): unresolvable R_X86_64_NONE relocation against symbol `_ZTVSt9basic_iosIcSt11char_traitsIcEE@@GLIBCXX_3.4'
/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
搜索更多信息R_X86_64_NONE并没有给出任何有价值的结果:大多数类似的问题没有任何答案或精确解释这是什么以及如何解决它.
所以我的问题是:
R_X86_64_NONE和为什么"没有任何重新定位"(根据bintils来源)ELF标题中存在的符号类型?附录:
-fPIC选项PS.我真的希望这个问题能够一次又一次地解决(已经打过几次,但这次更新到最新的binutils并没有帮助).(将对此问题的任何活动开始赏金)