linker-errors

Q_OBJECT throwing 'undefined reference to vtable' error [duplicate]

喜你入骨 提交于 2019-11-26 16:01:42
This question already has an answer here: Qt Linker Error: “undefined reference to vtable” [duplicate] 9 answers I'm using Qt Creator 2.0.1 with Qt 4.7.0 (32 bit) on Windows 7 Ultimate 32 bit. Consider the following code, which is a minimum to produce the error: 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; } The above code fragment causes the following linker errors: In function `T': undefined

Apple Mach-O Linker Warning “Directory Not Found For Option…”

十年热恋 提交于 2019-11-26 15:48:51
问题 I simply want to rid of the warnings that pop up like these: 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

Call C standard library function from asm in Visual Studio

寵の児 提交于 2019-11-26 15:30:19
I have a problem with calling C function from asm project created in visual studio (Win10 x64, Visual Studio 2015). Project consist of one asm file: .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 When I build project, linker outputs the error: Error LNK2019 unresolved external symbol _printf referenced in function _main@0 Linker output parameters: /OUT:"C:\Users\apple\Documents\SP_Lab7\Debug\SP_Lab7_Demo

Error when compiling some simple c++ code

情到浓时终转凉″ 提交于 2019-11-26 15:24:34
I try to compile this cpp code on osx lion but I get an error. #include <iostream> using namespace std; int main (int argc, char *argv[]) { for(int i = 0; i < 10; i++) { cout << "hi"; cout << endl; } return 0; } To compile: cc main.cpp Error: Undefined symbols for architecture x86_64: "std::cout", referenced from: _main in ccBdbc76.o "std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)", referenced from: _main in ccBdbc76.o "std::basic_ostream<char, std::char_traits<char> >& std::endl<char

file was built for archive which is not the architecture being linked (i386)

喜夏-厌秋 提交于 2019-11-26 13:09:50
问题 I got to build static library. I want to use in my iPhone and ipad app. When I try to run the simulator I get linking errrors. I am new to iOS development. kindly help; ld: warning: ignoring file /Users/valuelabs/Desktop/DruvaProject/libraries/libnetUtils.a, file was built for archive which is not the architecture being linked (i386) Undefined symbols for architecture i386: "_OBJC_CLASS_$_netUtils", referenced from: objc-class-ref in ViewController.o ld: symbol(s) not found for architecture

Why am I getting “undefined reference to sqrt” error even though I include math.h header? [duplicate]

[亡魂溺海] 提交于 2019-11-26 12:53:56
This question already has an answer here: undefined reference to sqrt (or other mathematical functions) 5 answers I'm very new to C and I have this code: #include <stdio.h> #include <math.h> int main(void) { double x = 0.5; double result = sqrt(x); printf("The square root of %lf is %lf\n", x, result); return 0; } But when I compile this with: gcc test.c -o test I get an error like this: /tmp/cc58XvyX.o: In function `main': test.c:(.text+0x2f): undefined reference to `sqrt' collect2: ld returned 1 exit status Why does this happen? Is sqrt() not in the math.h header file? I get the same error

undefined reference to sqrt (or other mathematical functions)

帅比萌擦擦* 提交于 2019-11-26 12:22:45
I have this simple code: max = (int) sqrt (number); and in the header I have: #include <math.h> But application still says undefined reference to sqrt . Do you see any problem here? It looks like everything should be okay. You may find that you have to link with the math libraries on whatever system you're using, something like: gcc -o myprog myprog.c -L/path/to/libs -lm ^^^ - this bit here. Including headers lets a compiler know about function declarations but it does not necessarily automatically link to the code required to perform that function. Failing that, you'll need to show us your

Undefined reference to `sin` [duplicate]

心已入冬 提交于 2019-11-26 11:43:46
This question already has an answer here: undefined reference to sqrt (or other mathematical functions) 5 answers I have the following code (stripped down to the bare basics for this question): #include<stdio.h> #include<math.h> double f1(double x) { double res = sin(x); return 0; } /* The main function */ int main(void) { return 0; } When compiling it with gcc test.c I get the following error, and I can't work out why: /tmp/ccOF5bis.o: In function `f1': test2.c:(.text+0x13): undefined reference to `sin' collect2: ld returned 1 exit status However, I've written various test programs that call

Linker Error in iOS (duplicate symbols for architecture x86_64)

自作多情 提交于 2019-11-26 11:08:32
问题 I keep on getting the following error: duplicate symbol _llvm.embedded.module in: /Users/name/Documents/FacebookSDKs-iOS-20150910/FBSDKCoreKit.framework/FBSDKCoreKit(FBSDKApplicationDelegate.o) /Users/name/Documents/FacebookSDKs-iOS-20150910/FBSDKCoreKit.framework/FBSDKCoreKit(FBSDKServerConfiguration.o) ld: 102 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) I\'ve tried deleting the FBSDK and reinstalling, but that has

undefined reference to `__gxx_personality_sj0`

僤鯓⒐⒋嵵緔 提交于 2019-11-26 07:38:57
问题 With gcc 4.6 when trying to execute this code: #include <iostream> using namespace std; #include <bitset> int main() { //Int<> a; long long min = std::numeric_limits<int>::min(); unsigned long long max = std::numeric_limits<int>::max(); cout << \"min: \" << min << \'\\n\'; cout << \"max: \" << max << \'\\n\'; cout << (min <= max); std::bitset<64> minimal(min); cout << \"minimal: \" << minimal; return 0; } I\'m getting the following error: 1. undefined reference to __gxx_personality_sj 2.