我在pod文件中添加了Fabric和Crashlytics.当我更新pods时,我遇到带有重复符号的链接器错误.我在这里发现它在Fabric.framework和Crashlytics.framework中都有相同的文件但是如何从我的角度解决这个问题呢?
duplicate symbol _CLSMachOEnumerateSlicesAtAddress in:
Location/Crashlytics.framework/Crashlytics(CLSMachO.o)
Location/Pods/Fabric/iOS/Fabric.framework/Fabric(CLSMachO.o)
duplicate symbol _CLSMachOFileDestroy in:
Location/Crashlytics.framework/Crashlytics(CLSMachO.o)
Location/Pods/Fabric/iOS/Fabric.framework/Fabric(CLSMachO.o)
duplicate symbol _CLSMachOFileEnumerateSlices in:
Location/Crashlytics.framework/Crashlytics(CLSMachO.o)
Location/Pods/Fabric/iOS/Fabric.framework/Fabric(CLSMachO.o)
duplicate symbol _CLSMachOFileInitWithPath in:
Location/Crashlytics.framework/Crashlytics(CLSMachO.o)
Location/Pods/Fabric/iOS/Fabric.framework/Fabric(CLSMachO.o)
duplicate symbol _CLSMachOGetDylibPath in:
Location/Crashlytics.framework/Crashlytics(CLSMachO.o)
Location/Pods/Fabric/iOS/Fabric.framework/Fabric(CLSMachO.o)
duplicate symbol _CLSMachOGetEncrypted in:
Location/Crashlytics.framework/Crashlytics(CLSMachO.o)
Location/Pods/Fabric/iOS/Fabric.framework/Fabric(CLSMachO.o)
duplicate symbol _CLSMachOGetLinkedSDKVersion in:
Location/Crashlytics.framework/Crashlytics(CLSMachO.o)
Location/Pods/Fabric/iOS/Fabric.framework/Fabric(CLSMachO.o)
duplicate symbol _CLSMachOGetMinimumOSVersion in:
Location/Crashlytics.framework/Crashlytics(CLSMachO.o)
Location/Pods/Fabric/iOS/Fabric.framework/Fabric(CLSMachO.o)
duplicate symbol _CLSMachOGetUUID in:
Location/Crashlytics.framework/Crashlytics(CLSMachO.o)
Location/Pods/Fabric/iOS/Fabric.framework/Fabric(CLSMachO.o)
duplicate symbol _CLSMachONormalizeUUID in:
Location/Crashlytics.framework/Crashlytics(CLSMachO.o)
Location/Pods/Fabric/iOS/Fabric.framework/Fabric(CLSMachO.o)
duplicate symbol _CLSMachOSliceEnumerateLoadCommands in:
Location/Crashlytics.framework/Crashlytics(CLSMachO.o)
Location/Pods/Fabric/iOS/Fabric.framework/Fabric(CLSMachO.o)
duplicate symbol _CLSMachOSliceGetArchitectureName in:
Location/Crashlytics.framework/Crashlytics(CLSMachO.o)
Location/Pods/Fabric/iOS/Fabric.framework/Fabric(CLSMachO.o)
duplicate symbol _CLSMachOSliceGetCurrent in:
Location/Crashlytics.framework/Crashlytics(CLSMachO.o)
Location/Pods/Fabric/iOS/Fabric.framework/Fabric(CLSMachO.o)
duplicate …Run Code Online (Sandbox Code Playgroud) 我想在iPhone上使用Lua.在Mac OS X上,在普通(非iOS)Cocoa应用程序中,我使用了以下代码:
lua_State* l;
l = lua_open();
luaL_openlibs(l);
luaL_loadstring(l, "print(\"Hi from Lua\");");
lua_pcall(l, 0, 0, 0);
Run Code Online (Sandbox Code Playgroud)
我从lua.org/ftp下载了Lua 5.1.4并将其编译为Mac OS X.在Xcode项目中,我使用"添加现有框架"进行添加,liblua.a并使用"添加现有文件"添加include目录.
这按预期工作,并打印字符串:"来自Lua".当我在iOS项目中尝试相同的事情时,它会给出错误:
"_luaL_newstate", referenced from:
_main in main.o
more of the same thing...
symbol(s) not found
collect2: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)
似乎.a文件没有链接到iPhone应用程序.有人知道如何使这项工作?
(顺便说一句,我真的不在乎苹果可能不接受我的应用程序,如果它有Lua.)
今天我在从2008年到2010年更新VS版本时遇到了链接问题,错误是这样的:
error LNK2019: unresolved external symbol "public: static void __cdecl std::_String_base::_Xran(void)" (?_Xran@_String_base@std@@SAXXZ) referenced in function "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::assign(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned int,unsigned int)" (?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@ABV12@II@Z)
error LNK2019: unresolved external symbol "public: static void __cdecl std::_String_base::_Xlen(void)" (?_Xlen@_String_base@std@@SAXXZ) referenced in function "protected: bool __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Grow(unsigned int,bool)" (?_Grow@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IAE_NI_N@Z)
Run Code Online (Sandbox Code Playgroud)
我在网上搜索了这个问题,并在这个地址找到了类似的帖子:http://social.msdn.microsoft.com/Forums/en/vcgeneral/thread/5ac28a31-3339-4db1-90f4-68edad360309
但这些答案都不能解决我的问题.谁能给我一些如何解决这个问题的技巧?
非常感谢您的帮助!
我正在尝试为名为sierra chart的应用程序编译.DLL.
这是我需要修复的警告所以它都指向链接器输出值:
警告MSB8012:TargetPath(C:\ SierraChart\VCProject\Release\SCStudies.dll)与链接器的OutputFile属性值(c:\ sierrachart\data\SCStudies.dll)不匹配.这可能会导致您的项目错误地构建.要更正此问题,请确保$(OutDir),$(TargetName)和$(TargetExt)属性值与%(Link.OutputFile)中指定的值匹配.C:\ Program Files(x86)\ MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets
有任何想法吗?
当我尝试编译以下代码时,我得到一个链接器错误:Undefined symbols for architecture x86_64: "Foo()", referenced from: _main in main.o使用LLVM 4.2.
仅在标记函数时才会出现此问题constexpr.当标记功能时,程序会正确编译和链接const.为什么声明该函数constexpr会导致链接器错误?
(我意识到以这种方式编写函数不会带来编译时计算的好处;此时我很好奇为什么函数无法链接.)
main.cpp中
#include <iostream>
#include "test.hpp"
int main()
{
int bar = Foo();
std::cout << bar << std::endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
test.hpp
constexpr int Foo();
Run Code Online (Sandbox Code Playgroud)
TEST.CPP
#include "test.hpp"
constexpr int Foo()
{
return 42;
}
Run Code Online (Sandbox Code Playgroud) 我有Xcode的问题,不断给我一个链接器错误,它不构建项目.以下是我得到的错误
ld:找不到文件:/Users/someuser/Library/Developer/Xcode/DerivedData/MAR-akbwbarcniqxytctbebckkelkbxs/Build/Products/Debug-iphonesimulator/MAR.app/MAR
clang:错误:链接器命令失败,退出代码为1(使用-v查看调用)
我正在尝试使用Visual Studio 2013在Windows 7上编译我的一个项目.我已经安装了Boost 1.53并使用cmake设置了解决方案.
现在发生的是现在编译的boost库就是这种形式libboost_*-vc120-mt(-gd)-1_53.lib.在链接器项目选项中,在输入选项卡下,我已经验证了我需要的库,并且实际上编译器能够正确读取它们.
但是,由于某种原因,我完全无法理解,链接器也在尝试查找编译为的库vc110.例如:
error LNK1104: cannot open file 'libboost_filesystem-vc110-mt-gd-1_53.lib'
Run Code Online (Sandbox Code Playgroud)
项目选项中列出的Platform Toolset是"Visual Studio 2013(v120)".我在任何项目选项中都找不到对vc110的引用.你能帮我理解发生了什么吗?
我的团队最近从2015英特尔编译器(并行工作室)升级到2018年版本,我们遇到了一个链接器问题,每个人都在撕扯他们的头发.
我有以下类(为了简洁而适度编辑)来处理子进程的包装和相关的文件描述符以便与它们交谈:
class SubprocWrapper
{
public:
static const int PASSTHRU_FD = 0;
static const int MAKE_PIPE = -1;
typedef std::map<std::string, std::string> EnvMapType;
static EnvMapType getMyEnv();
SubprocWrapper(
int stdin_fd_req,
int stdout_fd_req,
int stderr_fd_req,
const std::string & execPath,
const std::vector<std::string> & args,
const std::set<int> & dont_close_fds,
const EnvMapType * env = 0);
};
Run Code Online (Sandbox Code Playgroud)
然后我用以下代码调用它:
std::string runCmd = "/run/some/file.bin";
std::vector<std::string> args(2);
args[0] = "-c";
args[1] = runCmd;
SubprocWrapper::EnvMapType env_vars = SubprocWrapper::getMyEnv();
SubprocWrapper subproc(
SubprocWrapper::PASSTHRU_FD,
SubprocWrapper::PASSTHRU_FD,
SubprocWrapper::PASSTHRU_FD,
std::string("/bin/sh"),
args,
std::set<int>(), //dont_close_fds = null means …Run Code Online (Sandbox Code Playgroud) 我pthread.h在一个*.cc文件中使用.当我尝试使用pthread_exit(0);或pthread_join(mythrds[yy],NULL);它说:
.cc:(.text+0x3e): undefined reference to `pthread_exit'
Run Code Online (Sandbox Code Playgroud)
当*.c使用gcc 在文件中编译非常相似的代码时,它工作得很完美.我如何在c ++中使用pthread ..(我还添加了-lpthread)
..
void *myThreads ( void *ptr )
{
...
pthread_exit(0);
}
..
Run Code Online (Sandbox Code Playgroud)
标志:
g++ -lpthread -Wall -static -W -O9 -funroll-all-loops -finline -ffast-math
Run Code Online (Sandbox Code Playgroud) 我正在使用SSL-Vision软件.它有一个示例客户端,我一直试图从整个项目中分离出来.我找到了自己编辑客户端所需的资源,所以我只是从软件中复制它们并使用CMake构建我的客户端.
下面的项目结构已经简化,缩小了问题(我相信!).
.
??? CMakeLists.txt
??? main.cc
??? build
? ??? CMakeLists.txt
? ??? messages_ssl_... (.cc/.h, 4 each)
??? src
??? CMakeLists.txt
??? (Other subdirs and sources/headers)
Run Code Online (Sandbox Code Playgroud)
./CMakeLists.txt:
cmake_minimum_required(VERSION 2.6)
项目(TestClient)find_package(PkgConfig REQUIRED)
pkg_check_modules(QTCORE_PKG QtCore)
include_directories($ {QTCORE_PKG_INCLUDE_DIRS})include(FindProtobuf)
find_package(Protobuf REQUIRED)
include_directories($ {PROTOBUF_INCLUDE_DIRS})find_package(PkgConfig REQUIRED)
pkg_check_modules(GLIB_PKG glib-2.0)
include_directories($ {GLIB_PKG_INCLUDE_DIRS})include_directories("src")add_subdirectory(src)
include_directories("build")add_subdirectory(build)
add_executable(clientTest clientTest.cc)
target_link_libraries(clientTest robocup_ssl_client messages_robocup_ssl_detection.pb messages_robocup_ssl_geometry.pb messages_robocup_ssl_wrapper.pb messages_robocup_ssl_refbox_log.pb netraw robocup_ssl_client protobuf QtCore)
./build/CMakeLists.txt:
add_library(messages_robocup_ssl_detection.pb SHARED messages_robocup_ssl_detection.pb.cc)
add_library(messages_robocup_ssl_refbox_log.pb SHARED messages_robocup_ssl_refbox_log.pb.cc)
add_library(messages_robocup_ssl_geometry.pb SHARED messages_robocup_ssl_geometry.pb.cc)
add_library(messages_robocup_ssl_wrapper.pb SHARED messages_robocup_ssl_wrapper.pb.cc)
这可能是一个缺少的#include的 …