SOIL library - unable to link - c++

While building my project, I get the same issue, solved in this links:
SOIL not linking correctly,
SOIL set-up in Visual Studio 2010
I tried every suggested solution:
build the VC8 and VC9 libraries to get the SOIL.lib (I'm using VS 2013)
linked the libraries (Linker - Additional Dependencies)
renamed the libSoil.a to SOIL.lib
but still having the same errors:
1>libSOIL.a(stb_image_aug.o) : error LNK2019: unresolved external symbol __alloca referenced in function _stbi_zlib_decode_noheader_buffer
1>libSOIL.a(image_helper.o) : error LNK2019: unresolved external symbol _sqrtf referenced in function _RGBE_to_RGBdivA2
Any ideas , other solutions?

Related

C++ - Unable to link in libyaml using Visual Studio 2019/CMake

Attempting to link in libyaml (0.2.5) using Visual Studio 2019 Enterprise and CMake, as I have a cross-platform (Linux/Windows) project that uses this library. According to the documentation, this library should work in Windows 10. It links in just fine on Linux (64-bit machine).
I'm compiling it as a static lib, and it has no issue generating the .lib file. I've copied it to the appropriate location that I'm linking in from my CMakelists.txt, as well as the header.
When I link it in from my project on Windows:
ts.lib(yamlparser.cxx.obj) : error LNK2019: unresolved external symbol __imp_yaml_parser_initialize referenced in function "public: bool __cdecl YAMLParser::parse_cfg(void)" (?parse_cfg#YAMLParser##QEAA_NXZ)
ts.lib(yamlparser.cxx.obj) : error LNK2019: unresolved external symbol __imp_yaml_parser_set_input_file referenced in function "public: bool __cdecl YAMLParser::parse_cfg(void)" (?parse_cfg#YAMLParser##QEAA_NXZ)
ts.lib(yamlparser.cxx.obj) : error LNK2019: unresolved external symbol __imp_yaml_parser_scan referenced in function "public: bool __cdecl YAMLParser::parse_cfg(void)" (?parse_cfg#YAMLParser##QEAA_NXZ)
This is what I'm doing on the CMake side - the very same thing I'm doing to link in my GoogleTest libraries on both Linux and Windows:
if (UNIX)
...
...
else()
set (MY_LIB_DIR "C:/mylib/lib")
set (MY_INCLUDE "C:/mylib/include")
set (YAML_LIB "${MY_LIB_DIR}/yaml.lib")
set (VCPKG_LIBRARY_LINKAGE static)
endif()
include_directories(${MY_INCLUDE})
add_library(ts
...
...
)
add_executable(myexec main.cxx)
target_link_libraries(myexec ts ${YAML_LIB})
VS isn't giving me many clues here except that there's a linkage problem that I can't quite figure out.
Any advice on how I can debug this or what the problem may be?
The __imp was the clue that my code was trying to include the library dynamically... Opening up yaml.h, I noticed that it tries to export from DLL unless YAML_DECLARE_STATIC is defined. Defined this in CMake and my issue is resolved.

Compiling in VS2013: error LNK2001 using C++

I'm trying to compile my game with Visual Studio 2013. The game uses Box2D, but when compiling in Release mode the release Box2D.lib is giving errors. It works fine when compiling in Debug mode with the debug Box2D.lib.
I'm getting 135 errors, and mainly something like these three:
1>Box2D.lib(b2CollideEdge.obj) : error LNK2001: unresolved external symbol #__security_check_cookie#4
1>MyContactListener.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) char const * __cdecl std::_Winerror_map(int)"
(__imp_?_Winerror_map#std##YAPBDH#Z)
1>Box2D.lib(b2ContactManager.obj) : error LNK2001: unresolved external symbol _atexit
I have built the Box2D.lib's several times now, and I'm sure I'm linking to the right release and debug libraries.
I tried disabling the compiler flag /GS (Buffer Security Check), but that didn't help.
For building the Box2D.lib and when compiling the game I use the flag Multi-threaded DLL (/MD) for runtime library.
EDIT: I got rid of the errors "#__security_check_cookie#4" when I linked with the library "bufferoverflowU.lib". Still, 133 errors remain.
You probably disabled linking of default run-time libraries in linker options. Right-click on the project and go to properties. Under Linker->Input set an option Ignore All Default Libraries to No.

Installing GLFW 3.0 not working Visual Studio

I'm trying to create a GLFW project, but I'm getting LNK2019 errors with the basic setup.
I've downloaded the latest binary (glfw-3.0.bin.WIN32.zip) to a folder.
I've created a new, empty console project.
Within VC++ Directories, I've added the following line to include directories:
C:\C++Libraries\glfw-3.0.bin.WIN32\include
I've added the following line to the Library Directories:
C:\C++Libraries\glfw-3.0.bin.WIN32\lib-msvc110
I've linked the following libraries:
opengl32.lib, glfw3.lib, glfw3dll.lib
From the latest tutorial, I paste into my project (no visible syntax errors) to test, but I get four LNK2019 errors after trying to run it.
Here are the errors:
Error 2 error LNK2019: unresolved external symbol __imp__joyGetPosEx#8
referenced in function __glfwPlatformGetJoystickAxes
c:\Users\Spicy Weenie\documents\visual studio 2012\
Projects\Beta\Beta\glfw3.lib(win32_joystick.obj)
Error 3 error LNK2019: unresolved external symbol __imp__joyGetDevCapsW#12
referenced in function __glfwPlatformGetJoystickAxes
c:\Users\Spicy Weenie\documents\visual studio
2012\Projects\Beta\Beta\glfw3.lib(win32_joystick.obj)
Error 4 error LNK2019: unresolved external symbol __imp__joyGetPos#8
referenced in function __glfwPlatformJoystickPresent
c:\Users\Spicy Weenie\documents\visual studio
2012\Projects\Beta\Beta\glfw3.lib(win32_joystick.obj)
Error 1 error LNK2019: unresolved external symbol __imp__timeGetTime#0
referenced in function __glfwInitTimer c:\Users\Spicy Weenie\documents\visual
studio 2012\Projects\Beta\Beta\glfw3.lib(win32_time.obj)
You need to link in at least winmm.lib for timeGetTime. The joystick code is probably in there to.

Can't get GLEW to work with VS2012

I have been trying to figure this out for hours but with no luck:
error LNK2019: unresolved external symbol _imp_glBegin#4 referenced in function _main
error LNK2019: unresolved external symbol _imp_glEnd#4 referenced in function _main
error LNK2019: unresolved external symbol _imp_glFlush#4 referenced in function _main
error LNK1120: 3 unresolved externals
Pretty standard errors for linking, but I tried everything that came to my mind without luck unfortunately.
My setup is as follows:
SFML 2.0 as the window manager
GLEW 1.90 as the OpenGL extension manager
SFML is working, so it's correctly linked etc...
I have included GLEW include and library directories, I have also added glew32d.lib to the Additional Dependencies + added the glew32d.dll to the Debug folder (where the .exe resides)
I also built GLEW from source, so it should work :S
GLEW stands for "OpenGL Extension Wrangler Library". It doesn't define core OpenGL functions like glBegin() and glEnd(). Are you also including your opengl32.lib, glu32.lib, and glut32.lib libs?

unresolved external symbol _gluLookAt#72 referenced in function

I'm making a program using the glu library but when i compile i got this error:
1>opengl_3.obj : error LNK2019: unresolved external symbol _gluLookAt#72 referenced in function "public: void __thiscall OpenGLContext::setupScene(void)" (?setupScene#OpenGLContext##QAEXXZ)
I included GL/glu.h and checked if the lib and dll were present. (they are by default)
I'm using visual studio 2012.
Any idea where this error is coming from?
You are not linking to glu. Add glu to the libraries against which your program should be linked. A more detailed description can be found here.