About graphics.h, winbgim.h and libbgi.a libraries in codeblock - codeblocks

I added the full library graphic.h, winbgim.h, libbgi.a and its path in linker setting and other linker but it didn't work and it showed an error:
ld.exe cannot find -lbgi

ld will give you that error if it can't find libbgi.a for static builds or libbgi.dll.a shared builds.
Make sure the path containing libbgi.a is set it the linker paths as in this screenshot:
Another thing you could try is to build a static version of your project in order to avoid using a missing shared library.

Related

XCode can't find j2objc jre_emul library

I import j2objc to my project, but I still get error like Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_Test (public class Test in java source). I found something about wrong linking static library to project (libjre_emul.a). I found possible official solution add to Other Linker Flags flag "-l jre_emul".
Problem is I get error ld: library not found for -l jre_emul what does it mean? How can I fix this?
I tried extended command:
"-l jre_emul -ObjC -force_load ${PROJECT_DIR}/lib/libjre_emul.a"
Error library not found still remains. Any idea?
Thanks.
I think you have a spelling error in your other linker flags. Try to use something like:
-l"jre_emul"
The -force_load flag is no longer necessary. The issue is that the linker can't find the library because the path to it is not defined in your project (it's probably not in ${PROJECT_DIR}/lib, unless you explicitly put it there). The Update the Build Settings wiki section describes how to add the J2ObjC distribution path to your project's Library Search Paths build setting.

Building a Shared Library but linking against a Static One

I have an Autogen Makefile.am that I'm trying to use to build a test program for a shared library. To build my test binary, I want to continue building the shared library as target but I want the test program to be linked statically. I've spent the last few hours trying to craft my Makefile.am to get it to do this.
I've tried explicitly changing the LDADD line to use the .a version of the library and get a file not found error even though I can see this library is getting built.
I try to add the .libs directory to my link path via LDFLAGS and still it can't find it.
I tried moving my library sources to my test SOURCES list and this won't work because executable object files are built differently than those for static libraries.
I even tried replicating a lib_LIBRARIES entry for the .a version (so there's both a lib_LTLIBRARIES and a lib_LIBRARIES) and replicate all the LDFLAGS, SOURCES, dir and HEADERS for the shared version as part of the static version (replacing la with a of the form _a_SOURCES = _la_SOURCES. Still that doesn't work because now it can't figure out what to build.
My configure.ac file is using the default LT_INIT which should give me both static and dynamic libraries and as I said it is apprently building both even if the libtool can't see the .a file.
Please, anyone know how to do this?
As #Brett Hale mentions in his comment, you should tell Makefile.am that you want the program to be statically linked.
To achieve this you must append -static to your LDFLAGS.
Changing the LDFLAGS for a specific binary is achieved by changing binary_LDFLAGS (where binary is the name of the binary you want to build).
so something like this should do the trick:
binary_LDFLAGS = $(AM_LDFLAGS) -static

Problems compiling with libraries

I am trying to compile some C++ code which uses the CGAL library on OS X Lion. I downloaded and installed on some directory the CGAL library. Then, when I try to compile the code, using "make";
triangulation.h:18:64: error: CGAL/Exact_predicates_inexact_constructions_kernel.h: No such file or directory
which means it does not find the CGAL lib. I look at the Makefile, and I see that it compiles using the flag
-lCGAL
Wondering how to solve this, I guess I could pass the information about the placement of my compiled library to this variable, but I do not how. I tried with export and so on but it does not recognize it, any hints?
The error message doesn't mean the library isn't found; it means a header file isn't found. The -lCGAL switch does indeed refer to the library. You're going to need a -IXXXXX switch added on to CFLAGS, where XXXXX is the path to the directory containing the CGAL directory which in turn contains Exact_predicates_inexact_constructions_kernel.h .

ld: After successful linking shared lib not found on execution

I am currently working on a simple data synchonizer in a mixture of Fortran and C/C++ by using OpenMPI libraries. The synchonizer compiles and links correctly, as far as I can see:
f95 -o fortran_mpi_test *.o -L/usr/lib/gcc/x86_64-redhat-linux/4.1.1/
-L/usr/lib64/openmpi/1.4-gcc/lib/ -lmpi -lmpi_cxx -lstdc++
But when I execute the resulting executable on the same machined I get an error stating that one of the shared libraries is not found. That is confirmed by ldd.
Nevertheless the missing library libmpi_cxx.so.0 is located in one of the specified folders.
Could anyone give me a hint what I could have done wrong?
Check your environment variables. If your LIBRARY_PATH, LD_LIBRARY_PATH or similar vars have gotten out of sync or set to silly values you might not be searching the same directories for static libraries as you do for dynamics.
Also check out the ld.so manpage

Linker error despite including the files

I am having a linker error LNK 2001 unresolved external symbol.My point is I do have the respective include directory added under Project Settings->C/C++->General ->Additional Include .I see that this include directory does have the header file which contains the function which is causing the error.
I also add all the lib folders under linker options->general->additional lib dependencies.
What could be going wrong? How can I trace what file is missing?
You need more than just the library path, you need to specify the libraries explicitly. i.e something.lib
(under Linker->Input->Additional Dependencies in VS2005)
Linker errors have nothing to do with include files. You get compiler errors from missing include files/directories. The linker needs the actual definitions aka code to work its magic and create your binary file (exe/dll/static library etc...).
Are you linking to the library of which you are #includeing the headers from?

Resources