linker-errors

Undefined symbols error when using a header file

北城余情 提交于 2019-11-27 02:24:30
问题 I'm getting the following error and can't for the life of me figure out what I'm doing wrong. $ gcc main.c -o main Undefined symbols: "_wtf", referenced from: _main in ccu2Qr2V.o ld: symbol(s) not found collect2: ld returned 1 exit status main.c: #include <stdio.h> #include "wtf.h" main(){ wtf(); } wtf.h: void wtf(); wtf.c: void wtf(){ printf("I never see the light of day."); } Now, if I include the entire function in the header file instead of just the signature, it complies fine so I know

Linker error : undefined reference to symbol 'glOrtho'

 ̄綄美尐妖づ 提交于 2019-11-27 02:19:01
问题 I installed OpenGL packages in Ubuntu 13.04 ( *mesa-common-dev freeglut3-dev* ) and tried to run a sample program. #include "GL/freeglut.h" #include "GL/gl.h" /* display function - code from: http://fly.cc.fer.hr/~unreal/theredbook/chapter01.html This is the actual usage of the OpenGL library. The following code is the same for any platform */ void renderFunction() { glClearColor(0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0, 1.0, 1.0); glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1

“bad codegen, pointer diff” linker error with Xcode 4

前提是你 提交于 2019-11-27 02:13:34
问题 Recompiling a C++ iPhone app with Xcode 4 I get this nasty linker error: ld: bad codegen, pointer diff in __static_initialization_and_destruction_0(int, int) to global weak symbol vmml::Vector2<float>::ZERO for architecture armv6 Anyone know what it means? How to make it go away would be nice too of course :) The app compiled & linked without error in Xcode 3. Edit : the solution is to set Symbols Hidden By Default to Yes in all the build settings of all targets in the project. Still none the

Apple Mach-O Linker & Ditto Error - Xcode 8

夙愿已清 提交于 2019-11-27 01:36:54
问题 I have just updated my Xcode to Xcode 8 and am now trying to convert my project's code to Swift 2.3. I was able to build a couple times using Xcode 8 without any errors. Now, the following errors came up: Error #1: Apple Mach-O Linker Error: Linker command failed with exit code 1 ld: file not found: /Users/Linus/Library/Developer/Xcode/DerivedData/MyApp-asdjeshhsetnfxbegcsbcipdreneewgr/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/x86_64

undefined reference to `__gxx_personality_sj0`

自古美人都是妖i 提交于 2019-11-27 01:27:01
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. undefined reference to _Unwind_SjLj_Register 3. undefined reference to _Unwind_SjLj_Unregister 4. undefined reference to

Multiple definition of inline functions when linking static libs

非 Y 不嫁゛ 提交于 2019-11-27 01:04:47
I have a C++ program that I compile with mingw (gcc for Windows). Using the TDM release of mingw which includes gcc 4.4.1. The executable links to two static library (.a) files: On of them is a third-party library written in C; the other is a C++ library, written by me, that uses the C library provides my own C++ API on top. An (in my view, excessive) portion of the C library's functionality is implemented in inline functions. You can't avoid including the inline functions when you use the C library's API, but when I try to link it all together, I'm getting link errors saying there is a

inline function linker error

£可爱£侵袭症+ 提交于 2019-11-27 00:58:36
问题 I am trying to use inline member functions of a particular class. For example the function declaration and implementation without inlining is as such: in the header file: int GetTplLSize(); in the .cpp file: int NeedleUSsim::GetTplLSize() { return sampleDim[1]; } For some reason if I put the "inline" keyword in either one of the implementation and declaration, as well as in both places, I get linker errors as shown: Creating library C:\DOCUME~1\STANLEY\LOCALS~1\TEMP\MEX_HN~1\templib.x and

Unable to link GoogleAnalytics 3.01 with XCode 5 (missing required architecture x86_64)

蹲街弑〆低调 提交于 2019-11-27 00:20:48
问题 I have built my App (targeted for iOS7) and now want to apply Google Analytics as the last step before submission. What I did: Downloaded GA for iOS 3.01 Imported content of /GoogleAnalytics/Library/ into group "GoogleAnalytics" Imported libGoogleAnalyticsServices.a into group "GoogleAnalytics" Added Build Phases and swapped build phase libGoogleAnalytics_debug.a with libGoogleAnalyticsServices.a Added code block #include "GAI.h" to my -Prefix.pch -file. Initialize the [GAI sharedInstance] in

C error: undefined reference to function, but it IS defined

ぐ巨炮叔叔 提交于 2019-11-27 00:05:41
问题 Just a simple program, but I keep getting this compiler error. I'm using MinGW for the compiler. Here's the header file, 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); And here's 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; p.x = x; p.y = y; return p; } Point midpoint(Point p, Point q) {

Undefined reference to t1sl_steup_key_block when linking OpenSSL

眉间皱痕 提交于 2019-11-26 23:36:57
问题 I got a problem of linking an OpenSSL library into an existing project. Where I do get it wrong? Below are the steps I have followed. I have downloaded the SSL library, configured and installed it. It gets installed in /usr/local/ssl . 2) I have copied libcrypto.a and libssl.a from /usr/local/ssl/lib into my project, something like /mnt/linux/bla/bla/lib . 3) Then I edit the make file and added path of libssl libcrpto there. The path added is one that is in project like /mnt/linux/bla /bla 3)