Tag: 链接器错误

链接器错误:“链接器input文件未使用,因为链接没有完成”,未定义的引用该文件中的函数

我在链接我的文件时遇到了麻烦。 基本上,我的程序包括: 主程序gen1 。 gen1 – 接收input发送到str2value进行处理,输出结果str2value ,使用“tokenizer”确定input到令牌的处理方式,确定对每个令牌执行什么样的处理,并将它们传递给str2num或str2cmd 。 然后它返回一个结果数组。 str2num – 做一些处理 str2cmd – 同上 author.py – 一个str2cmd.h文件cmdTable.h生成str2cmd.c和str2cmd.h的python脚本。 我很确定我有我的包括权利,我已经检查了几次。 我也检查了在标题中没有#ifndef错误的条件。 这是我的Makefile: #CPP = g++ -lserial CPP = g++ -DTESTMODE C= gcc DEFINES = LURC CFLAGS = -Wall -fshort-enums -D$(DEFINES) PROJECTFILES = gen1.cpp str2value.o STR2VALUEFILES = str2value.cpp str2cmd.o str2num.o tokenizer.o str2value.h gen1 : $(PROJECTFILES) $(CPP) […]

在制作GTest时出错

我试图在我的Ubuntu机器上设置GTest环境。 但同时使GTest获得图书馆,我得到以下错误… som@som-VPCEH25EN:~/Workspace/CPP/gtest-1.6.0/make$ make g++ -I../include -g -Wall -Wextra -lpthread sample1.o sample1_unittest.o gtest_main.a -o sample1_unittest gtest_main.a(gtest-all.o): In function `~ThreadLocal': /home/som/Workspace/CPP/gtest-1.6.0/make/../include/gtest/internal/gtest-port.h:1336: undefined reference to `pthread_getspecific' /home/som/Workspace/CPP/gtest-1.6.0/make/../include/gtest/internal/gtest-port.h:1340: undefined reference to `pthread_key_delete' /home/som/Workspace/CPP/gtest-1.6.0/make/../include/gtest/internal/gtest-port.h:1336: undefined reference to `pthread_getspecific' /home/som/Workspace/CPP/gtest-1.6.0/make/../include/gtest/internal/gtest-port.h:1340: undefined reference to `pthread_key_delete' gtest_main.a(gtest-all.o): In function `testing::internal::ThreadLocal<std::vector<testing::internal::TraceInfo, std::allocator<testing::internal::TraceInfo> > >::GetOrCreateValue() const': /home/som/Workspace/CPP/gtest-1.6.0/make/../include/gtest/internal/gtest-port.h:1372: undefined reference to `pthread_getspecific' /home/som/Workspace/CPP/gtest-1.6.0/make/../include/gtest/internal/gtest-port.h:1379: undefined reference […]

C错误:未定义的函数引用,但它被定义

只是一个简单的程序,但我不断收到这个编译器错误。 我正在使用MinGW编译器。 这是头文件point.h : //type for a Cartesian point typedef struct { double x; double y; } Point; Point create(double x, double y); Point midpoint(Point p, Point q); 这里是point.c : //This is the implementation of the point type #include "point.h" int main() { return 0; } Point create(double x, double y) { Point p; px […]

试图包含一个库,但不断收到'未定义的引用'的消息

我正在尝试使用libtommath库。 我在Ubuntu linux上为我的项目使用了NetBeans IDE。 我已经下载并构build了库,我已经做了一个“make install”,将生成的.a文件放入/ usr / lib /和.h文件到/ usr / include 这似乎是find适当的文件(因为我不再得到这些错误,我安装到/ usr目录之前)。 但是,当我创build一个简单的主调用mp_init(在库中),当我尝试使我的项目时,我得到以下错误: mkdir -p build/Debug/GNU-Linux-x86 rm -f build/Debug/GNU-Linux-x86/main.od gcc -c -g -MMD -MP -MF build/Debug/GNU-Linux-x86/main.od -o build/Debug/GNU-Linux-x86/main.o main.c mkdir -p dist/Debug/GNU-Linux-x86 gcc -o dist/Debug/GNU-Linux-x86/cproj1 build/Debug/GNU-Linux-x86/main.o build/Debug/GNU-Linux-x86/main.o: In function 'main': /home/[[myusername]]/NetBeansProjects/CProj1/main.c:18: undefined reference to `mp_init' collect2: ld returned 1 exit status make[2]: […]

Qt链接器错误:“未定义的引用vtable”

这是我的标题: #ifndef BARELYSOCKET_H #define BARELYSOCKET_H #include <QObject> //! The First Draw of the BarelySocket! class BarelySocket: public QObject { Q_OBJECT public: BarelySocket(); public slots: void sendMessage(Message aMessage); signals: void reciveMessage(Message aMessage); private: // QVector<Message> reciveMessages; }; #endif // BARELYSOCKET_H 这是我的class级: #include <QTGui> #include <QObject> #include "type.h" #include "client.h" #include "server.h" #include "barelysocket.h" BarelySocket::BarelySocket() { //this->reciveMessages.clear(); […]

苹果Mach-O链接器警告“目录找不到选项…”

我只是想摆脱像这样popup的警告: ld: warning: directory not found for option '-F/Users/m/Desktop/FacebookSDK' ld: warning: directory not found for option '-F/Users/m/Desktop/FacebookSDK/FBAudienceNetwork' ld: warning: directory not found for option '-F/Users/gavin/Downloads/shaffiulla11-bat-b86d81d8adc6' ld: warning: directory not found for option '-F/Users/gavin/Desktop/shaffiulla11-bat-b86d81d8adc6' ld: warning: ignoring file /Users/Gavin/Desktop/FacebookSDK/Bolts.framework/Bolts, missing required architecture x86_64 in file /Users/Gavin/Desktop/FacebookSDK/Bolts.framework/Bolts (2 slices) 很明显,我现在使用的是不同的目录,因为我的驱动器有多个重新格式化,因为逻辑板的问题,只是想知道最方便的方法,我可以摆脱这些错误。 感谢您的时间和帮助。

找不到符号:kUTTypeImage

我从苹果的文档复制了一些代码 – 我得到了这两个错误: Undefined symbols for architecture i386: "_kUTTypeImage", referenced from: -[ImagePicker imagePickerController:didFinishPickingMediaWithInfo:] in ImagePicker.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation) 我究竟做错了什么? 编辑:代码: – (IBAction) showSavedMediaBrowser { [self startMediaBrowserFromViewController: self usingDelegate: (id)self]; } – (BOOL) startMediaBrowserFromViewController: (UIViewController*) controller usingDelegate: (id […]

在Visual Studio中从asm调用C标准库函数

我在Visual Studio中创build的asm项目(Win10 x64,Visual Studio 2015)中调用C函数时遇到问题。 项目由一个asm文件组成: .586 .model flat, stdcall option casemap:none includelib msvcrt.lib ExitProcess PROTO return:DWORD extern printf:near .data text BYTE "Text", 0 .code main PROC push offset text call printf add esp,4 invoke ExitProcess,0 main ENDP end main 当我build立项目,链接器输出错误: 在函数_main @ 0中引用LNK2019未parsing的外部符号_printf时出错 链接器输出参数: /OUT:"C:\Users\apple\Documents\SP_Lab7\Debug\SP_Lab7_Demo.exe“/ MANIFEST:NO / NXCOMPAT /PDB:"C:\Users\apple\Documents\SP_Lab7\Debug\SP_Lab7_Demo.pdb”/ DYNAMICBASE “kernel32.lib”“user32.lib”“gdi32.lib”“winspool.lib”“comdlg32.lib”“advapi32.lib”“shell32.lib”“ole32.lib”“oleaut32.lib”“uuid.lib” “odbc32.lib”“odbccp32.lib”/ MACHINE:X86 / […]

未定义的sqrt引用(或其他math函数)

我有这个简单的代码: max = (int) sqrt (number); 并在头上我有: #include <math.h> 但是应用程序仍然说对sqrt未定义引用。 你有什么问题吗? 它看起来像一切应该没问题。

Q_OBJECT抛出'未定义的引用vtable'错误

我在Windows 7 Ultimate 32位上使用Qt Creator 2.0.1和Qt 4.7.0(32位)。 考虑下面的代码,这是产生错误的最小值: class T : public QObject, public QGraphicsItem { Q_OBJECT public: T() {} QRectF boundingRect() const {return QRectF();} void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {} }; int main() { T t; return 0; } 上面的代码片段导致以下链接器错误: 在函数“T”中: 未定义的引用'vtable for T' 未定义的引用'vtable for T' 在函数'〜T'中: 未定义的引用'vtable for T' […]