SDL C++ ttf linker errors - c++

I'm using CodeBlocks and trying to link SDL_ttf when compiling my program. I have followed thus instructions:
Add "-lSDL_ttf" in the linker command line
Put SDL_ttf.dll in library directory
Put SDL_ttf.h in include file directory
And I have this error when compiling:
ld.exe||cannot find -lSDL_ttf|
||=== Build finished: 1 errors, 0 warnings ===|
I've tried so many methods to solve this and I feel like banging my head against a brick wall.
I'm running Windows and I have moved the .dll to my system32 as well as the project folder and put the header files in my compilers includes folder.

You also need the .lib file to link against. Put the .lib file in your library directory; you may also need to add that directory to your linker's search path with the -L <path> option.

you have to use -lSDL2_ttf instead -lSDL_ttf

Related

Cannot find -Ifreeglut

I am working on Glut Project in Code::Blocks. I have Freeglut.dll in windows folder in C Drive. I have also copied this file in sysWOW64 (as i am using windows 10). But it still gives the error mentioned in the pictures bellow:
The linker does not find Freeglut.lib. Most probably you missed to add the path to the lib directory to the linker options. I don't know how to do this in Code::Blocks, but in general you have to add these additional library directories using the -L<DIR> switch for the linker.

LNK1104 Error when trying to setup SFML 2.3.1 in MS Visual Studio COmmunity 2015

I'm no expert in programming, and have never used SFML previously, but thought I would give it a try for fun tonight. I followed the instructions on the sfml-dev.org, but when I try to run the testprogram that's supposed to render a circle, I get the following build error:
Error LNK1104 cannot open file 'sfml-graphics-s-d.lib
sfml-window-s-d.lib sfml-system-s-d.lib sfml-audio-s-d.lib
sfml-network-s-d.lib opengl32.lib freetype.lib jpeg.lib winmm.lib
gdi32.lib openal32.lib ws2_32.lib
kernel32.lib' Win32Project2 C:\Users\Johan\documents\visual studio
2015\Projects\Win32Project2\Win32Project2\LINK 1
I added the dependencies from opengl32.lib to ws2_32.lib because sfml-dev.org stated that the 5 main libraries were dependent on those. What could cause this problem?
Did you define SFML_STATIC in the pre-processor options? I normally don't like linking to SFML libraries statically. Just put the libraries in the same directory of your executable and link to the dynamically.
Example:
Make sure to append your libraries with -d when you link to them if you're compiling a debug version, ex: sfml-graphics-d. Remove -d otherwise.
You need to put the appropriate DLL's in your project directory: Go to "bin" in your SFML folder, copy and paste everything, then go back to the folder that has all your source files for your project and paste there. Looking at your error message, it should be here:
C:\Users\Johan\documents\visual studio 2015\Projects\Win32Project2\Win32Project2\

Add obj file to linker input with cmake

I have a cmake project that needs to link to a library that contains some .lib files and a .obj file. I've found some clues to how to link to a .obj file, but most solutions seem very complex.
All I really want to do is tell cmake to add the .obj file to the linker input in my Visual Studio project.
I tried linking it as I am doing with normal lib files:
target_link_libraries(Foo C:/a.lib C:/b.lib C:/c.obj)
However when I check the linker input in the generated VS project, cmake has removed the full-path and appended .lib to the obj file:
C:/a.lib
C:/b.lib
c.obj.lib
What's the simplest way of getting this result:
C:/a.lib
C:/b.lib
C:/c.obj
Note that this only needs to work with Windows and Visual Studio.
I was facing facing the same issue when I found your question. It is solved by the following line:
SET_TARGET_PROPERTIES(my_project PROPERTIES LINK_FLAGS "/link setargv.obj")
The link is appended to Additional Options in the Command Line Section from project's linker settings.

Linker library error in visual studio

Running visual studio 2010 writing an openGL program in C++
I'm getting this error, and can't for the life of me figure out why
fatal error LNK1104: cannot open file 'Image_Loading/nvImage.lib'
The file is in the correct place, and nvImage.lib is present in the additional dependencies of the linker, any ideas??
The folder "Image_Loading" is probably not in your library search path. Include files has a different search path, so even if its find the includes, the folder might be missing from the libary search path.
you should either add the folder to the LIB enviromental variable, or add /LIBPATH:folder to the command line of the linker.

glew32.lib linker error

I am writing a basic toon shader in OpenGL. I am using MSVC 2008. I have included the GLEW libraries. I have also set the additional dependencies in linker. But I am getting the following error:
LINK : fatal error LNK1104: cannot open file 'glew32.lib'
You need to set your linker to look in the correct place for the library. Either you don't have the lib, or your linker can't find it. Open your project properties dialog, go to linker, specify the lib as a dependency and provide the path to the correct lib folder.
you can also drag and drop the glew32.lib (or any other lib file of course) into your visual studio project and i think it will be automagically linked in and the linker will find it (which i think is your problem).
anyhow, i prefer setting my search directories by hand.
add this:
#pragma comment(linker, "/NODEFAULTLIB:libc.lib")
It will definitely solve your problem.