linker-errors

SOLVED: relocation R_X86_64_32 against symbol `G8' can not be used when making a PIE object; recompile with -fPIE

↘锁芯ラ 提交于 2020-08-09 09:14:06
问题 I'm trying to compile lambda-expressions from scheme to llvm-ir and am having trouble with position independet code. source: (lambda (x) (display x)) target: bunch of declares... define %SObj* @G7() { entry: %calltmp = call %SObj* @closure_create(i64 ptrtoint (%SObj* (%SObj*)* @G8 to i64), %SObj* null) ret %SObj* %calltmp } define %SObj* @G8(%SObj* %G6) { entry: %calltmp = call %SObj* @display(%SObj* %G6) ret %SObj* %calltmp } define i32 @main(i32 %0, i8** %1) { entry: %calltmp = call %SObj*

Linking dll/lib to a cmake project

此生再无相见时 提交于 2020-06-27 08:42:14
问题 I was trying to link a library to my cmake project but I was getting linker errors. I spent 2 hours trying to resolve the problem and I created simple project where I hardcoded all the paths. CMAKE_MINIMUM_REQUIRED(VERSION 3.0) PROJECT(Testing CXX) INCLUDE_DIRECTORIES("B:/Projects/TMH/Libraries/Awesomium/inc") SET(SOURCE_FILES src/Main.cpp src/Application.cpp src/Window.cpp ) ADD_EXECUTABLE(Testing ${SOURCE_FILES}) TARGET_LINK_LIBRARIES(Testing B:/Projects/TMH/Libraries/Awesomium/bin

Why error LINK2005: object already defined error disappears when I declare the object as static

前提是你 提交于 2020-06-23 07:43:26
问题 I have the follwoing structure and object of structure defined in the header file as below: struct STConfigurationDetails { bool bAutoStart; bool bAutoLog; bool bAutoScan; bool bAutoMount; bool bAutoOpen; bool bAutoDetectLast; }; struct STConfigurationDetails g_objConfigurationDetails ; In the header file it self I have both method and method body which is using g_objConfigurationDetails . This works fine when I include the header file to another cpp file and call the method. But the moment I

What does a dangerous relocation error mean?

a 夏天 提交于 2020-06-13 18:40:55
问题 I am getting a linking error: dangerous relocation: l32r: Literal placed after use: I am still trying to debug; however, I want to better understand this error. I understand what relocation is; however, I am not sure how it can be dangerous and was looking for some clarification. Also, a small code snippet that could generate this type of error would be helpful. In short, what is " a dangerous relocation "? 回答1: This is a two-part answer, as there are really two questions here, one general (

Linker error when calling printf from _start [duplicate]

為{幸葍}努か 提交于 2020-06-09 04:17:28
问题 This question already has answers here : Assembling 32-bit binaries on a 64-bit system (GNU toolchain) (2 answers) Closed 3 years ago . I tried to write simple program without main segment .data fmt db "test", 0xa, 0 segment .text global _start extern printf _start: lea rdi, [fmt] ; print simple string xor eax, eax call printf mov eax, 60 ; exit successfully xor edi, edi syscall Compile: yasm -f elf64 main.s; ld -o main main.o Got main.o: In function `_start': main.s:(.text+0xb): undefined

Linker error when calling printf from _start [duplicate]

浪尽此生 提交于 2020-06-09 04:17:06
问题 This question already has answers here : Assembling 32-bit binaries on a 64-bit system (GNU toolchain) (2 answers) Closed 3 years ago . I tried to write simple program without main segment .data fmt db "test", 0xa, 0 segment .text global _start extern printf _start: lea rdi, [fmt] ; print simple string xor eax, eax call printf mov eax, 60 ; exit successfully xor edi, edi syscall Compile: yasm -f elf64 main.s; ld -o main main.o Got main.o: In function `_start': main.s:(.text+0xb): undefined