linker

Link step can't find symbols (XC8 compiler)

两盒软妹~` 提交于 2020-01-05 05:55:45
问题 I'm trying to compile and link a C program using the XC8 compiler. I changed from the C18 compiler and made some minor compatibility changes to the code. With C18, the code compiled and linked just fine. With XC8, compiling goes fine, but the link step fails with this error: Error [500] ; 0. undefined symbols: _putch(server.obj) _ENC_Init(server.obj) _ENC_WriteRegister(server.obj) _ENC_ReadRegister(server.obj) As the compiling succeeds, I guess there are prototypes found, ergo the .h files

Is it viable to mix two static libraries with different optimization levels?

扶醉桌前 提交于 2020-01-05 05:49:07
问题 I have two static libraries named libx.a and liby.a . libx.a is compiled with gcc -g ; while liby.a is compiled with gcc -O3 . I want to link them two into a single executable. Is it viable? Is it harmful? 回答1: Yes, it is viable, it isn't harmful as long as the optimizations don't change the ABI (of function calls, or of floating point arithmetic/representation, etc.). Although even in those cases, I believe all necessary information is already compiled in or the linker resolves the issues.

CMake: Link precompiled library depending on OS and architecture

扶醉桌前 提交于 2020-01-05 05:35:10
问题 I have different, precompiled versions of a 3rd-party library (Windows/Linux/Mac, 32/64-bit). It must be included in the project files to keep the requirements for compilation on other systems to a minimum and because I cannot expect it to be available for download years later. Both static and dynamic versions are available but no source. How should I link it in my CMakeLists.txt so that the dependent main.cpp compiles on all systems? Would it work on different Linux distributions? CMAKE

How to link C lib against python for embedding under Windows?

随声附和 提交于 2020-01-05 05:29:09
问题 I am working on an application written in C. One part of the application should embed python and there is my current problem. I try to link my source to the Python library but it does not work. As I use MinGW I have created the python26.a file from python26.lib with dlltool and put the *.a file in C:/Program Files (x86)/python/2.6/libs . Therefore, I compile the file with this command: gcc -shared -o mod_python.dll mod_python.o "-LC:\Program Files (x86)\python\2.6\libs" -lpython26 -Wl,--out

MinGW32: Linking against ImageMagick with -static flag

蓝咒 提交于 2020-01-05 04:35:07
问题 I am currently trying to build a Windows-version of emacs that supports ImageMagick. For that purpose I have already compiled ImageMagick with MinGW32/MSys in order to get compatible library files. Basically linking also works, though I have to add explicitly -llibMagickCore-6.Q16 and -llibMagickWand-6.Q16 to the linking command through configure.bat 's --lib option. However, the binary distribution of emacs for windows is supposed to load, even when the dependencies are absent. This

Linking C code with Cuda code

泄露秘密 提交于 2020-01-05 02:34:07
问题 So I'm writing a very basic CUDA code (vector addition) to teach myself the basics of CUDA programming. I've got it working when I write one .cu file, but now I am trying to make it work with a .c and .cu file linked together. My main.c file is as follows: #include "Test.h" #include <stdlib.h> int main(int argc, char *argv[]) { int n = 1000; size_t size = n * sizeof(float); int i; float *h_a = malloc(size), *h_b = malloc(size), *h_c = malloc(size); for(i = 0; i < n; i++) { h_a[i] = h_b[i] = i

error LNK2001: unresolved external symbol _IID_IDirectDraw2

孤街醉人 提交于 2020-01-04 11:04:15
问题 I work with piece of legacy code which uses direct draw and I'm in rather embarrassing situation. Not long ago I've updated my system and had to adapt to the new situation (loading ddraw.dll) and everything worked fine. Today I explored another legacy solution which also uses classes (files) I've changed, but I'm stuck with above mentioned linking error. I've checked and compared project properties and they seam fine. This is code for directX initialization, "troublesome" code is bold.

Visual C++ Runtime Library Linker Woes

一个人想着一个人 提交于 2020-01-04 07:31:29
问题 Observe this close Scenario even though it appears to be the same as my previous questions. Still I am not getting an answer. So please don't report as a duplicate. I have a project which has 10 dependencies. First I compiled using the /MTD option in the C/C++ codegeneration section in the main project and all its dependencies are getting build successfully. Next I changed the option from /MTD to /MDd and again all dependent projects are getting build successfully. But for the main project

CMake linking glfw3 lib error

坚强是说给别人听的谎言 提交于 2020-01-04 07:02:56
问题 i'm working with CLion, and I'm writing a program using the glfw3 lib.(http://www.glfw.org/docs/latest/) I installed and did everything correctly for the lib i have the .a and .h files in: /usr/local/lib/libglfw3.a /usr/local/include/.h(all files) I'm trying to use the library now, but i'm getting the linker error: undefined reference to 'glViewport' etc. etc. all the functions i'm using I added the lib path to the make file, I can't understand what i'm doing wrong, my CMakeLists.txt looks

CMake Linking Fails

拜拜、爱过 提交于 2020-01-04 06:52:09
问题 I'm configuring my project for CMake and am having linking problems - the project files all compile successfully, then it says it is linking and reports all sorts of symbols not found. These symbols are mostly provided by my own code, while some of them are provided by BerkeleyDB, which is being properly located and included. Here is my top-level CMakeLists.txt: cmake_minimum_required(VERSION 2.6) project( rpdb C ) # add local modules path for project set( CMAKE_MODULE_PATH ${CMAKE_MODULE