I'm developing a game, and am trying to use bullet. However, (it seems that) I am having trouble linking the bullet libraries. Edit 2: I have my code on github
This is actually my first time using cmake. I have searched through the FindBullet.cmake file, and could find the variable to link libraries(${BULLET_LIBRARIES}), but linking the libraries in the variable didn't do anything.
find_package(Bullet REQUIRED)
include_directories(${BULLET_INCLUDE_DIR})
target_link_libraries(3DPlatformer ${BULLET_LIBRARIES})
I expected the my code to compile but instead I got a bunch of, "undefined refrence to" then whatever function from bullet it read.
edit:
more undefined references to `btAlignedAllocInternal(unsigned long, int)' follow
^ thats what I got a bunch of
collect2: error: ld returned 1 exit status
And that is the last error.
Full Error
libbullet-dev need to be installed.
sudo apt-get install libbullet-dev
My issue is that one of my if statements was broken.
My if statement:
if(USE_SYSTEM_BULLET)
find_package(Bullet REQUIRED)
include_directories(${BULLET_INCLUDE_DIR})
target_link_libraries(3DPlatformer ${BULLET_LIBRARIES} -lGL -lGLU)
else(USE_SYSTEM_BULLET)
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/bullet" )
include_directories("${PROJECT_SOURCE_DIR}/lib/bullet/src")
endif(USE_SYSTEM_BULLET)
was somehow triggering all the code instead of some of it. commenting the code like this:
#if(USE_SYSTEM_BULLET)
find_package(Bullet REQUIRED)
include_directories(${BULLET_INCLUDE_DIR})
target_link_libraries(3DPlatformer ${BULLET_LIBRARIES} -lGL -lGLU)
#else(USE_SYSTEM_BULLET)
# add_subdirectory("${PROJECT_SOURCE_DIR}/lib/bullet" )
# include_directories("${PROJECT_SOURCE_DIR}/lib/bullet/src")
#endif(USE_SYSTEM_BULLET)
fixed it.
Related
*This is my first programming course in over 20 years, so I am basically clueless.
I am trying to complete the last project in the course which includes installing and configuring SDL. Right now all I have is the basic "Hello World" code. I get the error when I add #include .
When I installed SDL, I copied the SDL2 folder and the entire lib folder to MinGW-w64 - as instructed by a tutorial.
I have MinGW-w64 installed. Here is the build error:
C:/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o):crt0_c.c:(.text.startup+0x2e): undefined reference to `WinMain'
collect2.exe: error: ld returned 1 exit status
I've been googling for hours and cannot seem to find any help.*
Edit:
Thank you both so much for your quick responses.
Here is what I did in settings:
Do I need to put an 'l' in front of these items?
I got some help elsewhere and added #define SDL_MAIN_HANDLED. This allowed the project to build, but it still doesn't run. I get nothing at all when I try to run it. I tried calling SDL_GetError(), but still nothing.
also make sure your main has the following signature:
int main(int, char**) - SDL is pretty militant about it
I have set up a video streaming system with OpenCv and Cairo. Unfortunately, now when I attempt to build, I get all sorts of undefined references to libpangocairo-1.0.so.0. I'd like a solution where I can just ignore these undefined references, or explicitly and exclusively point to the correct dependency.
Side note: I am using CMake.
It seems that my system library files are accidentally being queried instead of the user installed dependencies for OpenCv.
Things I have tried:
• Reinstalled libpangocairo
• Changed the LD_LIBRARY_PATH to explicitly point at our cairo library dependency within the repo
• Updated Glib to 2.27 from 2.0 (source said that Cario/OpenCv depends on the a later version of GLibc - I think he actually said 2.39, which doesn't exist :white_frowning_face:)
• Updated GTK to 3.0 which also contains glib and would install its most recent version
• Copied libpangocairo from /usr/lib to our repositories dependencies (build points correctly to the newly located lib but still same error)
• Completely wiped my environment and set up environment from scratch
Error Message:
//usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so.0: undefined reference to `cairo_ft_scaled_font_unlock_face'
//usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so.0: undefined reference to `cairo_ft_font_options_substitute'
//usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so.0: undefined reference to `cairo_ft_font_face_create_for_pattern'
//usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so.0: undefined reference to `cairo_ft_scaled_font_lock_face'
collect2: error: ld returned 1 exit status
I got some trouble trying to compile a programm developed by some researcher supposed to compute in a very precise way fourier transform and some other useful operation scientific paper here, whereas all the files needed and the makefile are provided.
I use gcc and a version of ubuntu available on windows10 (18.04), so, I linked all the librabries needed by the program and called in the pre-made makefile (fftw, lapack, gfortran..) everything is ok untill here, but once I tried to compile I got the error message:
/usr/bin/ld: cannot find -lgfortranbegin
collect2: error: ld returned 1 exit status
Makefile:38: recipe for target 'furian_main' failed
make: *** [furian_main] Error 1
After a few research it appears that libfortranbegin is a legacy code and no more available(source: here ) ..
So my question is: is it possible for me to compile my program without this legacy library (somme people say that we could get rid off this library, but I didn't understand what they do .. here)
Or should I do some update or use another library ?
Thank you for your time and consideration :)
The usual way of solving this is the following one:
remove the -lgfortranbegin
check the new link errors and look at what source file from the original source code implemented this feature
add this source file to your repository and your build and go back to step 2.
Be aware that it may still not work in the end, but hopefully you will be able to have the missing symbols.
Heading
I am trying to use Boost Wave, but I fail to compile it with those samples in boost_1_55_0/lib/wave/samples. The system I am using is Ubuntu 12.04 64-bit
For examples, when I try to compile the quick_start.cpp I use the commend:
c++ -I ~/Documents/boost_1_55_0 quick_start.cpp -o parser \
~/Documents/boost_1_55_0/stage/lib/libboost_wave.a
The libboost_wave.a is what I get from the ./b2 build commend of boost. The compile output is a super long result ending with:
collect2: ld returned 1 exit status
Part of the rest of output looks like(they are so long):
/tmp/ccpBhjhs.o: In function `boost::filesystem::operator!=(boost::filesystem::path
const&, boost::filesystem::path const&)':
quick_start.cpp: (.text._ZN5boost10filesystemneERKNS0_4pathES3_[boost::filesystem::operator!=(boost::filesystem::path const&, boost::filesystem::path const&)]+0x1f): undefined reference to `boost::filesystem::path::compare(boost::filesystem::path const&) const'
/tmp/ccpBhjhs.o: In function `boost::thread_exception::thread_exception(int, char const*)':
I have no clue what happened! Thanks for reading! If you can help me, Please!
p.s. I have built the wave library following the steps on Boost Website. I managed to use the regex library to build the sample e-mail extract program. So I think my wave library is built correctly.
Try the suggestions in this link:
Linking boost::filesystem on Ubuntu 13.04
1) Check that your boost library contains required symbols, you can use something like this: nm -D /usr/lib64/libboost_filesystem.so.1.52.0 | grep detail | c++filt | grep your names
2) Try to change order of linking library, for example put -lboost_bla-bla-bla to the end of command line, and run this command with g++ again, not use make or something, just copy paste command and make experiments with it.
3) And, of course, make sure you have a "libboost_filesystem.XXX" (either a static .a or shared .so library), and make sure it's in your "ld" (link) command.
every time I try to compile a sample program I get cv.h not found, highgui.c not found. I try to go to the includes folder in opencv and did a sudo copy * to usr/includes and did not help much: i got the following output can someone tell me what i do wrong?
stream_server.c:19:25: fatal error: /usr/include/highgui.h: Permission denied
compilation terminated.
uc#uc-HP-Pavilion-dv6-Notebook-PC:~/Desktop$ sudo gcc stream_server.c -o streamserver
stream_server.c: In function ‘quit’:
stream_server.c:174:5: warning: format not a string literal and no format arguments [-Wformat-security]
stream_server.c:177:5: warning: format not a string literal and no format arguments [-Wformat-security]
/tmp/ccVnjC7y.o: In function `cvDecRefData':
stream_server.c:(.text+0xa9a): undefined reference to `cvFree_'
stream_server.c:(.text+0xb22): undefined reference to `cvFree_'
/tmp/ccVnjC7y.o: In function `cvGetRow':
stream_server.c:(.text+0xc39): undefined reference to `cvGetRows'
/tmp/ccVnjC7y.o: In function `cvGetCol':
The first problem you have is that you apparently installed some file without the correct permissions. Since it seems you can use sudo, you might want to fix the permissions on the file:
sudo chmod a+r /usr/include/highgui.h
(similar to other files you don't have read permissions to).
The other problem indicates that you got your code to compile but not to link. This is most like because you either miss the library name entirely or you have it in the wrong location: make sure you use -lhighgui -lcvaux -lcxcore(this is what I gather from the docs; I haven't used this library myself) after any translation unit you provide (e.g., after stream_server.c; this looks suspiciously like a C file, implying a wrong language tag in action).