linker

OOP programming with data encapsulation in C

匆匆过客 提交于 2020-01-17 12:38:26
问题 I tried to do data encapsulation in C based on this post here https://alastairs-place.net/blog/2013/06/03/encapsulation-in-c/. In a header file I have: #ifndef FUNCTIONS_H #define FUNCTIONS_H // Pre-declaration of struct. Contains data that is hidden typedef struct person *Person; void getName(Person obj); void getBirthYear(Person obj); void getAge(Person obj); void printFields(const Person obj); #endif In ´functions.c´ I have defined the structure like that #include "Functions.h" enum { SIZE

How to fix OALAudio Library for XCode 6 / Kobold2D (Linker Error)

十年热恋 提交于 2020-01-17 08:39:06
问题 trying to update a Kobold2D/Cocos2d 2.1 project for iOS 8.1/XCode 6 on Yosemite. After using the solution provided here (How to update Kobold2D 2.1 project to MacOS10.10 / XCode 6.1?), I get a linker error that, despite all attempts (restarting, cleaning, deleting and adding frameworks) persists, and makes my project unstartable. I'm at my wit's end; this is a 3 year project, and I'm hitting a brick wall... The XCode 6.1 linker error reads as such: Ld /Users/fabian/Library/Developer/Xcode

Linking AVR programs with Cargo

懵懂的女人 提交于 2020-01-17 07:18:22
问题 I have a Rust project which I am currently compiling and linking by hand: rustc --target=avr-atmel-none src/main.rs --emit=obj -o _build/main.rs.o -C opt-level=3 avr-gcc -Os -Wl,--gc-sections -mmcu=atmega328p -o _build/image.elf _build/main.rs.o avr-objcopy -Oihex -R.eeprom _build/image.elf _build/image.hex I would like to automate this with Cargo, so I started by setting avr-gcc as the linker, by adding the following to .cargo/config : [build] target = "avr-atmel-none" [target.avr-atmel-none

Rust's .o file format not recognized by GCC

时间秒杀一切 提交于 2020-01-17 06:54:21
问题 I'm trying to build a simple application in C that calls Rust functions, in Windows, using MinGW with GCC 4.9.3 and Rust 1.9.0 stable. Here's the source code: test.rs #![crate_type = "staticlib"] #[no_mangle] pub extern "C" fn get_number() -> isize { 42 as isize } main.c #include <stdio.h> int get_number(); int main() { printf("Hello, world!\n"); printf("Number is %d.\n", get_number()); return 0; } Now, I know I should use C-compatible types in Rust and whatnot. But before going into program

Linker (ld v2.23.2 from MinGW) error at form: -L<SOMEDIR> -l<lib1 -l<lib2>,

扶醉桌前 提交于 2020-01-17 05:12:25
问题 Have ld v2.23.2 from mingw-builds 4.8.0 32bit suite. In my project in a directory there are libs: libitpp.a and libitpp.dll.a. The first is simply static lib, the second is import library to correspondent shared lib (DLL on Windows). I tell linker to link there libs in following form: -L$$ITPP_DIR/libs -litpp and the linker always chooses the second lib (libitpp.dll.a), but I want the first (libitpp.a), because "-litpp" matches it exactly. At explicit instruction: $$ITPP_DIR/libs/libitpp.a

trouble compiling against static library

萝らか妹 提交于 2020-01-16 06:20:11
问题 I have created a static library, libstuff.a , with gcc and ar . I've installed the library in /custom/lib/dir/ and the header files in /custom/include/dir/ . When I try to compile another application against the archive, I am running into issues. The application I am trying to compile basically uses gcc -L/custom/lib/dir/ -I/custom/include/dir/ -lstuff . When I attempt to compile, I get error about a function I declare in stuff.h and define in stuff.c . main.c:51: undefined reference to

CMake executable linker error even though the libraries are linked

你。 提交于 2020-01-16 05:18:10
问题 I'm pretty new to CMake, but I already encountered an error which I do not understand. For given reasons, I have the following C++ setup: I have two own static libraries, multiple external static libraries and one executable. My own libraries a defines common stuff and all external libraries are linked into it. My library b defines more special stuff and has library a linked into it. Finally, b is linked into my executable c . Both b and c use functions from different external libraries,

How to link against .a files in Visual Studio 2012?

吃可爱长大的小学妹 提交于 2020-01-16 01:12:07
问题 I have some static libraries in the form of .a files, and accompanying header (.h) files. How can I tell the linker Visual Studio 2012 Windows Desktop Express to reference these files so that I don't get "unresolved external symbol" errors when I try to build? 回答1: Include the .h header files, and make sure they are present in your project Go to Project Properties > Configuration Properties > C/C++ > General > Additional Include Directories and add the path to the include directory where your

Homemade Kernel linker global variables and inline Strings cannot be accessed

吃可爱长大的小学妹 提交于 2020-01-15 15:18:30
问题 I have followed some tutorials on the web and created my own kernel. It is booting on GRUB with QEMU succesfully. But I have the problem described in this SO question, and I cannot solve it. I can have that workaround described, but I also need to use global variables, it would make the job easier, but I do not understand what should I change in linker to properly use global variables and inline strings. main.c struct grub_signature { unsigned int magic; unsigned int flags; unsigned int

Homemade Kernel linker global variables and inline Strings cannot be accessed

≯℡__Kan透↙ 提交于 2020-01-15 15:16:54
问题 I have followed some tutorials on the web and created my own kernel. It is booting on GRUB with QEMU succesfully. But I have the problem described in this SO question, and I cannot solve it. I can have that workaround described, but I also need to use global variables, it would make the job easier, but I do not understand what should I change in linker to properly use global variables and inline strings. main.c struct grub_signature { unsigned int magic; unsigned int flags; unsigned int