Project Compilation Error - cannot find -lwxmsw28 - c++

While compiling a project i get the following error as
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot find lwxmsw28
collect2: ld returned 1 exit status
make[2]: *** [dist/Debug/MinGW-Windows/libRegistration.dll] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
I am using wxwidgets libraries however when i ran a command in cmd as
wx-config --libs
i could not see lwxmsw28 either let me know if it is downloadable from somewhere or any workaround to resolve this issue.
Thanks

This is a linker error, rather than a compilation error.
"lwxmsw28" looks to me like a wxwidgets v2.8 microsoft windows library. Should the linker be looking for this? Since you are using mingw, I would think you should NOT be linking to msw libraries. However, I am not familiar with mingw, so maybe this is the name used for mingw libraries.
If this is the correct library, then the next question is: have you built the wxWidgets libraries? The libraries are NOT "downloadable from somewhere" - you must download the source and build the libraries yourself.
A simple test to find out if you have built the libraries - try to build one of the sample projects.

Related

How to fix 'cannot find -lgmp' build error on OMNeT++?

I have become aware that OverSim can be used with the newer versions of OMNeT++. I installed OMNeT++ 5.6.1 on Windows 10 by following the instructions in InstallGuide. Then, I imported INET 3.6.5 in OMNeT++ and built it, there were no errors. Finally, I imported OverSim-20190424 and when I build it I get the following error at the end of the build process:
make[1]: Entering directory '/c/omnet561/oversim-20190424/src'
Creating executable: ../out/gcc-debug/src/OverSim_dbg.exe
C:/omnet561/omnetpp-5.6.1/tools/win64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgmp
collect2.exe: error: ld returned 1 exit status
make[1]: *** [Makefile:418: ../out/gcc-debug/src/OverSim_dbg.exe] Error 1
make[1]: Leaving directory '/c/omnet561/oversim-20190424/src'
make: *** [Makefile:11: all] Error 2
"make MODE=debug -j8 all" terminated with exit code 2. Build might be incomplete.
12:15:59 Build Failed. 3 errors, 0 warnings. (took 12s.448ms)
The other two errors are:
Description Resource Path Location Type
make: *** [Makefile:11: all] Error 2 OverSim C/C++ Problem
make[1]: *** [Makefile:418: ../out/clang-debug/src/OverSim_dbg.exe] Error 1 OverSim C/C++ Problem
Does anyone know how this error can be fixed? I have tried using OverSim on Windows 7 as well and tried using OMNeT++ 5.4.1 but the same error is still produced.
The libgmp libraries (libgmp-10.dll and libgmpxx-4.dll) are in the directory "C:/omnet561/omnetpp-5.6.1/tools/win64/mingw64/bin". I think the problem here might be that the software is using the wrong directory to search for the libraries but I'm not sure how to fix such an issue.
Try to add path to libgmp libraries using Makefrag.
Go to OverSim-20190424 Project Properties, choose OMNeT++ | Makemake | select src | Options | Custom | Makefrag and write:
LIBS += -L/c/libraries/libgmp
It is assumed that libgmp libraries (*.dll or *.a) are in C:\libraries\libgmp.
EDIT
Open Makefrag from oversim-20190424\src\ in a text editor, and then change LIBS and OMNETPP_LIBS to proper values:
LIBS += -L/sw/lib -L/c/omnet561/omnetpp-5.6.1/tools/win64/mingw64/bin
OMNETPP_LIBS += -lgmp
or
OMNETPP_LIBS += -lgmp-10
For anyone who encounters the same problem, I managed to solve it by using OMNeT++ 5.6.1 and Oversim 20190424 on Ubuntu 18.04. When I built Oversim, I got an error "Could not find gmp.h", to solve that error I installed libgmp3-dev - apt-get install libgmp3-dev. If somebody manages to get it to work on Windows 10 or has an idea of how it can be fixed, then please feel free to post.

Vulkan SDK Version 1.1.85.0 linking on Kubuntu 18.10

I'm currently working on a game engine with vulkan.
I just wanted to try whether it compiles on linux, but I don't know how to link my Vulkan SDK libraries. I downloaded the "vulkansdk-linux-x86_64-1.1.85.0.tar.gz" from the LunarG homepage, but now I dont know what I should link under "target_link_libraries".
I tried to link the "libvulkan.so" from the lib folder, but it does not work.
Some help from you would be great, because I never worked with CMAKE on linux.
/usr/bin/ld: cannot find -lvulkan
collect2: error: ld returned 1 exit status
make[3]: *** [CMakeFiles/Untitled.dir/build.make:669: ../output_linux /Untitled] Error 1
make[2]: *** [CMakeFiles/Makefile2:73: CMakeFiles/Untitled.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:85: CMakeFiles/Untitled.dir/rule] Error 2
make: *** [Makefile:118: Untitled] Error 2
Thanks for help,
Marlon
The SDK's Linux Getting Started Guide found in your SDK tarball and at this link explains much of this. In fact, there's even a section called "Using Vulkan in CMake Projects" that shows how to use the FindVulkan CMake module. The SDK also contains numerous example programs, also built with CMake.

Make/Cmake subdirectory linking to external library fails

I'm currently having trouble in the following setup:
My main project has a subdirector that is a library. This library depends on a system library "triangle" (installed from source). The main project does use a file from the subdirectory.
Cmake of the main project (and the library) work fine.
Building the library works just fine.
(Either in it's own directory or after cmake in the main directory with
make subdir_lib compiles without problems)
This is where the problems starts.
Building the main project with make project fails. It happens during linking:
subdir/libsubdir_lib.a(Test.cpp.o): In function `Test::run()':
/home/mimre/workspace/tmp/cmake-problem/subdir/files/Test.cpp:34: undefined reference to `triangle_context_create'
/home/mimre/workspace/tmp/cmake-problem/subdir/files/Test.cpp:35: undefined reference to `triangle_context_options'
/home/mimre/workspace/tmp/cmake-problem/subdir/files/Test.cpp:42: undefined reference to `triangle_mesh_create'
/home/mimre/workspace/tmp/cmake-problem/subdir/files/Test.cpp:50: undefined reference to `triangle_context_destroy'
collect2: error: ld returned 1 exit status
CMakeFiles/cmake_problem.dir/build.make:95: recipe for target 'cmake_problem' failed
make[3]: *** [cmake_problem] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/cmake_problem.dir/all' failed
make[2]: *** [CMakeFiles/cmake_problem.dir/all] Error 2
CMakeFiles/Makefile2:79: recipe for target 'CMakeFiles/cmake_problem.dir/rule' failed
make[1]: *** [CMakeFiles/cmake_problem.dir/rule] Error 2
Makefile:118: recipe for target 'cmake_problem' failed
make: *** [cmake_problem] Error 2
To avoid having a wall of code in here, I uploaded a minimal example onto github: https://github.com/mimre25/cmake_problem
Also, this is the library I'm using, installed with cmake & sudo make install: https://github.com/wo80/Triangle
I've tried the solutions from various similar threads but to no avail.
Thanks in advance for any help!
I would have written this as a comment but I don't have enough reputation for that. Is this a situation where you need to use this Triangle (https://github.com/wo80/Triangle), rather than the original Triangle (https://www.cs.cmu.edu/~quake/triangle.html)? If you can use the latter, I know from experience that its is very easy to link to. I just put it in a subdirectory in my code with this CMakeLists.txt.
## This only works for linux. Use an if statement to handle all architectures.
SET(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} -O -DLINUX -DTRILIBRARY -w -DANSI_DECLARATORS"
)
SET(FILES_SOURCE
triangle.h triangle.c
)
ADD_LIBRARY( my_local_name_for_triangle_library STATIC ${FILES_SOURCE} )
And then I can link to the triangle library I have created like this:
include_directories(my_local_triangle_dir)
target_link_libraries(my_local_name_for_triangle_library)
However, some of the #define macros are missing in triangle.h, so you need to copy them from triangle.c to triangle.h.
It seems that you tried to link a library that doesn't exist (where CMake can find it).
You either need to create a find_library, or when you link to triangle, give a full path with name.
Alternatively, you can leave the source in a sub directory which you can call then link to the name.

Why can't the linker find the CppUnit libraries?

I am trying to learn the CPPUNIT i looked at the following link:
CPPUNIT
although the selected language here is c i have selected c++ while creating this application and have added the
C:\cppunit\cppunit-1.12.1\include to the include directories i have also added cppunitd,cppunit in the linker options however i still the errors as while i try to test the cppunit.
Errors:
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../../mingw32/bin/ld.exe: cannot find
-lcppunitd
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../../mingw32/bin/ld.exe: cannot find -lcppunit
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../../mingw32/bin/ld.exe: cannot find -lcppunit
collect2: ld returned 1 exit status
make[1]: *** [build/Debug/MinGW_1-Windows/tests/TestFiles/f1] Error 1
make: *** [.build-tests-impl] Error 2
BUILD TESTS FAILED (exit value 2, total time: 4s)
Need to use the -L flag and have a path to the library.
I experienced the same linker error and found that I only had 64-bit version of CppUnit installed while building 32-bit application. I solved it by installing 32-bit version of the library.

ld lookup to find library

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.