Ok so I am trying to link SFML in a CodeLite project but with no success. So what have I done :
Added the include folder of SFML to the IncludePaths of CodeLite.
Added the lib folder of SFML to the LibrariesSearchPath of CodeLite.
Added SFML_STATIC to Preprocessors in CodeLite.
Added the libraries to the LinkerOptions like this :
sfml-graphics;sfml-window;sfml-audio;sfml-network;sfml-system
Added the 5 dll's(sfml-graphics-2.dll.. etc) to the debug folder and to the project folder
This is the build log :
C:\WINDOWS\system32\cmd.exe /C ""E:/Program Files (x86)/CodeBlocks/MinGW /bin/mingw32-make.exe" -j4 SHELL=cmd.exe -e -f Makefile""
"----------Building project:[ Test - Debug ]----------"
mingw32-make.exe[1]: Entering directory 'F:/Dropbox/Programming/OpenGL/Test'
"E:/Program Files (x86)/CodeBlocks/MinGW/bin/g++.exe" -o ./Debug/Test #"Test.txt" -L. -LF:/Dropbox/Programming/SFML/SFML-2.3.2x86/lib sfml-graphics sfml-window sfml-audio sfml-network sfml-system
g++.exe: error: sfml-graphics: No such file or directory
g++.exe: error: sfml-window: No such file or directory
g++.exe: error: sfml-audio: No such file or directory
g++.exe: error: sfml-network: No such file or directory
g++.exe: error: sfml-system: No such file or directory
mingw32-make.exe[1]: *** [Debug/Test] Error 1
Test.mk:78: recipe for target 'Debug/Test' failed
mingw32-make.exe[1]: Leaving directory 'F:/Dropbox/Programming/OpenGL/Test'
mingw32-make.exe: *** [All] Error 2
Makefile:4: recipe for target 'All' failed
====1 errors, 0 warnings====
I am using CodeLite 9.0.9 and SFML-2.3.2x86.
1. "Starting from SFML 2.2, when static linking, you will have to link
all of SFML's dependencies to your project as well. This means that
if you are linking sfml-window-s or sfml-window-s-d for example, you
will also have to link opengl32, winmm and gdi32. Some of these
dependency libraries might already be listed under "Inherited
values", but adding them again yourself shouldn't cause any
problems."
Your linked libraries should have -s suffix if you're linking statically and you should link other libraries look at this.
2."When linking to multiple SFML libraries, make sure that you link them in the right order, it is very important for GCC. The rule is that libraries that depend on other libraries must be put first in the list. Every SFML library depends on sfml-system, and sfml-graphics also depends on sfml-window. So, the correct order for these three libraries would be: sfml-graphics, sfml-window, sfml-system -- as shown in the screen capture above." Set linking order to graphics-s/window-s/system-s/etc
3."It is important to link to the libraries that match the configuration: "sfml-xxx-d" for Debug, and "sfml-xxx" for Release. A bad mix may result in crashes."
From your build log I can see that you're building your project as Debug with Release libraries(those without -d suffix), then you have to change linked libraries to sfml-graphics-s-d/etc
If advices above won't work then you set search paths wrong. Good luck
Ok so I finally managed to fix it by changing the libraries like this : -lsfml-graphics-s;-lsfml-window-s;-lsfml-audio-s;-lsfml-network-s;-lsfml-system-s;-lopengl32;-lfreetype;-ljpeg;-lwinmm;-lgdi32;-lopenal32;-lws2_32
Related
First, I built the cryptlib (of cryptopp) in Visual Studio Code 2022. And tried a sample c++ program (using files from the library) and it worked fine.
Then, I included the library cryptlib.lib in my OMNeT++ project.
I also included the cryptopp folder for the .cpp and .h files of the library.
But when I build the omnet++ project, I get this error:
03:05:22 **** Incremental Build of configuration debug for project crypto_final ****
make MODE=debug all
cd src && /usr/bin/make
make1: Entering directory '/d/omnetpp-5.7/samples/crypto_final/src'
Server.cc
Creating executable: ../out/clang-debug/src/crypto_final_dbg.exe
lld-link: error: could not open 'liblibcpmt.a': No such file or directory
lld-link: error: could not open 'libLIBCMT.a': No such file or directory
lld-link: error: could not open 'libOLDNAMES.a': No such file or directory
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [Makefile:99: ../out/clang-debug/src/crypto_final_dbg.exe] Error 1
make[1]: Leaving directory '/d/omnetpp-5.7/samples/crypto_final/src'
make: *** [Makefile:2: all] Error 2
"make MODE=debug all" terminated with exit code 2. Build might be incomplete.
03:05:25 Build Failed. 2 errors, 0 warnings. (took 3s.352ms)
I don't even know what are these libraries or how to get them built.
Can anyone help, please?
Edit #1: btw, when I change the Target type from "Executable" to "Static library (.lib or .a) in makemake options, the project builds normally but does not run properly (has some bugs and no effects can appear on the simulation)
OMNeT++ project uses Makefile, therefore to add an external library or class one should modify makefrag.
You should go to Project | Properties | OMNeT++ | Makemake | select root or src of your project | Options, then Custom | Makefrag and write the following lines:
EXTRA_OBJS += -L/d/foo/lib -llibcpmt -lLIBCMT -lOLDNAMES
CFLAGS += -I/d/foo/include
where /d/foo/lib is an example of the directory which contains your cryptlib static files (e.g. liblibcpmt.a, libLIBCMT.a, ... ), and /d/foo/include - the directory that contains header files of cryptlib.
Omnet++ useses MinGW as the runtime system and the C++ compiler's ABI is incompatible with the MS ABI (i.e. C++ code generated by Visual Studio C++ compiler is incompatible with the code generted by gcc or clang).
You MUST compile your crypto library also with the clang compiler coming with OMNeT++. Visual Studio compiler will NOT work.
Or... OpenSSL libraries and headers are already available in the Windows distro, so you can pt to use that.
I'm using an Ubuntu virtual machine and am encountering the following error message when running the 'make' command:
Scanning dependencies of target AIToolboxMDP
[ 1%] Building CXX object src/CMakeFiles/AIToolboxMDP.dir/Impl/Seeder.cpp.o
[ 1%] Building CXX object src/CMakeFiles/AIToolboxMDP.dir/Impl/CassandraParser.cpp.o
In file included from /home/ben/AI/AI-Toolbox-master/include/AIToolbox/Impl/CassandraParser.hpp:4,
from /home/ben/AI/AI-Toolbox-master/src/Impl/CassandraParser.cpp:1:
/home/ben/AI/AI-Toolbox-master/include/AIToolbox/Types.hpp:7:10: fatal error: boost/multi_array.hpp: No such file or directory
7 | #include <boost/multi_array.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/CMakeFiles/AIToolboxMDP.dir/build.make:76: src/CMakeFiles/AIToolboxMDP.dir/Impl/CassandraParser.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1140: src/CMakeFiles/AIToolboxMDP.dir/all] Error 2
make: *** [Makefile:95: all] Error 2
I ran cmake right before make, and cmake was able to find Boost; I can also see that the multi_array.hpp file is in the folder /home/ben/AI/boost_1_77_0/boost, so I'm not sure why make can't find the file. I tried adding variations of the line target_link_libraries(program ${Boost_LIBRARIES}) into the CMakeLists.txt file and using variations of the -L/-l options with the make call, and neither method worked (although I wasn't sure which program name to use with target_link_libraries so I tried a bunch of guesses but maybe I didn't use the right one; I'm trying to build AI-Toolbox if that helps).
I also have to add several options to the cmake command I run right before make in order to get rid of any errors with that; here's what I enter in case that would do anything or if I need to add something else in there:
cmake .. -DBOOST_ROOT=/home/ben/AI/boost_1_77_0 -DLPSOLVE_INCLUDE_PATH=/home/ben/AI/lpsolve -DVCPKG_TARGET_TRIPLET=x64-linux -DCMAKE_TOOLCHAIN_FILE=/home/ben/AI/vcpkg/scripts/buildsystems/vcpkg.cmake
My CMakeLists.txt file contains the following lines (among others, but these seem like the most relevant) just in case that helps as well:
find_package(Boost ${BOOST_VERSION_REQUIRED} REQUIRED)
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
Would anyone have any ideas as to how I can get past the make error?
I ended up solving it by deleting my Boost folder and reinstalling it using the command sudo apt-get install libboost-all-dev; I just reran cmake and took out all the options I had been using except for the lpsolve one, and then when I ran make afterward I encountered no issues.
I'm trying to get started with SDL and trying to compile a 'hello world' starter app to check my configuration and I get this error:
C:/MinGW-4.8.1/bin/g++.exe -c "C:/Users/Me/Documents/Cpp_Projects/Demo_Graphics/main.cpp" -g -O0 -Wall -o ./Debug/main.cpp.o -I. -IC:/Users/Me/Documents/Cpp_Projects/SDL2/32bit/include
C:/MinGW-4.8.1/bin/g++.exe -o ./Debug/Demo_Graphics #"Demo_Graphics.txt" -L. -lC:/Users/Me/Documents/Cpp_Projects/SDL2/32bit/lib/
c:/mingw-4.8.1/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lC:/Users/Me/Documents/Cpp_Projects/SDL2/32bit/lib/
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[1]: *** [Debug/Demo_Graphics] Error 1
Demo_Graphics.mk:79: recipe for target 'Debug/Demo_Graphics' failed
mingw32-make.exe[1]: Leaving directory 'C:/Users/Me/Documents/Cpp_Projects/Demo_Graphics'
mingw32-make.exe: *** [All] Error 2
Makefile:4: recipe for target 'All' failed
1 errors, 0 warnings
The directory C:/Users/Me/Documents/Cpp_Projects/SDL2/32bit/lib/ certainly does exist and has the required SDL libraries in it, but I have no clue about compilers.
This is predefined code which should work so the problem is in set up somewhere?
The -l compiler flag is adding a library dependency. It does not specify a path in which to look for libraries (that is the -L flag), which appears to be what you are expecting.
In your error message:
-L. -lC:/Users/Me/Documents/Cpp_Projects/SDL2/32bit/lib/
You can see that the compiler is looking in your current working directory (.) for the library C:/Users/Me/Documents/Cpp_Projects/SDL2/32bit/lib/, but this is not a library -- this is the directory in which you're storing the SDL libraries.
In the CodeLite linker setup you want to change your library path to C:/Users/Me/Documents/Cpp_Projects/SDL2/32bit/lib/, or use
-LC:/Users/Me/Documents/Cpp_Projects/SDL2/32bit/lib/
as a build flag.
You also need to link to the SDL2 library, so you'll need to add -lSDL2 (possibly -lSDL2main as well, I can't remember the specifics of the SDL libraries) to your build/linker flags.
I have problem building Port Audio on windows machine. I am following this tutorial: http://portaudio.com/docs/v19-doxydocs/compile_windows_mingw.html
Running make after ./configure runs build process and finally outputs this message and that is where build process stop.
/bin/sh ./libtool --mode=link gcc -shared -rpath /usr/local/lib -no-undefined -
export-symbols-regex "(Pa|PaMacCore|PaJack|PaAlsa|PaAsio|PaOSS)_.*" -version-inf
o 2:0:0 -o lib/libportaudio.la src/common/pa_allocation.lo src/common/pa_convert
ers.lo src/common/pa_cpuload.lo src/common/pa_dither.lo src/common/pa_debugprint
.lo src/common/pa_front.lo src/common/pa_process.lo src/common/pa_stream.lo src/
common/pa_trace.lo src/hostapi/skeleton/pa_hostapi_skeleton.lo src/hostapi/wmme/
pa_win_wmme.lo src/os/win/pa_win_hostapis.lo src/os/win/pa_win_util.lo src/os/wi
n/pa_win_waveformat.lo -lwinmm
*** Warning: linker path does not have real file for library -lwinmm.
*** I have the capability to make that library automatically link in when
*** you link to this library. But I can only do this if you have a
*** shared version of the library, which you do not appear to have
*** because I did check the linker path looking for a file starting
*** with libwinmm but no candidates were found. (...for file magic test)
*** The inter-library dependencies that have been dropped here will be
*** automatically added whenever a program is linked with this library
*** or is declared to -dlopen it.
*** Since this library must not contain undefined symbols,
*** because either the platform does not support them or
*** it was explicitly requested with -no-undefined,
*** libtool will only create a static version of it.
libtool: link: lib -OUT:lib/.libs/libportaudio.lib src/common/pa_allocation.o s
rc/common/pa_converters.o src/common/pa_cpuload.o src/common/pa_dither.o src/com
mon/pa_debugprint.o src/common/pa_front.o src/common/pa_process.o src/common/pa_
stream.o src/common/pa_trace.o src/hostapi/skeleton/pa_hostapi_skeleton.o src/ho
stapi/wmme/pa_win_wmme.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o s
rc/os/win/pa_win_waveformat.o
./libtool: line 1115: lib: command not found
make: *** [lib/libportaudio.la] Error 127
I am newbie in building libraries so i dont understand what is wrong here.
Any help is appreciated.
I'm cross compiling to an arm embedded system and receiving an error that I have questions about. Here is the error:
[ 19%] Built target cxjpeg-6b
Linking CXX shared library /home/botbear/JAUS++-2.110519- src/libraries/jaus++/2.0/lib/libcxutils.so
/home/botbear/openwrt/trunk/staging_dir/toolchain-arm_v6k_gcc-linaro_uClibc- 0.9.32_eabi/lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.5.4/../../../../arm-openwrt-linux- uclibcgnueabi/bin/ld: cannot find -lpng
collect2: ld returned 1 exit status
make[2]: *** [/home/botbear/JAUS++-2.110519-src/libraries/jaus++/2.0/lib/libcxutils.so] Error 1
make[1]: *** [libcxutils/CxUtils/libcxutils/CMakeFiles/cxutils.dir/all] Error 2
make: *** [all] Error 2
As you can see the linker is looking for a static library named 'libpng'. In addition to the libpng lib., the command in the sub-make file using the -l switch to link to the following libraries: -lpng -lz -lX11 -lXtst -lpthread -Wl. All of the libraries (libpng,libz,libX11, etc) are in my host /usr/lib/ directory but my target toolchain does not have the the libraries. My question is if I manually recompile the libraries with my target compiler will that solved my problem? Or I'm going to have find and install packages for each of the libraries for my target platform.
Thanks in advance.
You seem to compile for the target, so you need target libraries. Either compiled by yourself or provided by the toolchain development environment (if you have one). The latter usually saves you some headaches (cross compiling and setting the paths where necessary).
I see you are using openwrt toolchain. Openwrt seems to have libpng as a package. I'd go with that if possible.