I use the GLFW example from https://www.glfw.org/documentation.html
I get these errors
Build started...
1>------ Build started: Project: generic RPG game, Configuration: Debug x64 ------
1>main.cpp
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>main.obj : error LNK2019: unresolved external symbol __imp_glClear referenced in function main
1>C:\Users\Joseph\Desktop\foldrr\generic RPG game\x64\Debug\generic RPG game.exe : fatal error LNK1120: 1 unresolved externals
1>Done building project "generic RPG game.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I included the glfw3.lib and the headers too
I use the x64 windows precompiled binaries version 3.3.2 (latest version as of right now)
if I comment out glClear(GL_COLOR_BUFFER_BIT); function in the example code the error goes away and I'm able to compile normally and by removing the GL_COLOR_BUFFER_BIT parameter in the function i get a 'glClear': function does not take 0 arguments error
also if i comment out the function and try to render simple triangle i get a error too
1>main.obj : error LNK2019: unresolved external symbol __imp_glBegin referenced in function main
1>main.obj : error LNK2019: unresolved external symbol __imp_glVertex2f referenced in function main
I know that similar question has been asked before but I didn't find anyone with this weird behaviour
Related
83
Back-ends: imgui_impl_dx9.cpp + imgui_impl_win32.cpp
Operating System: Windows 10
Compiler: Visual Studio 2019
My Issue/Question:
I keep getting constant linker errors when trying to compile my program and I cannot figure out what is causing them
I have the files required and they're included in the .sln properties and in my main.cpp
1>------ Build started: Project: ConsoleApplication2, Configuration: Debug Win32 ------
1>ConsoleApplication2.cpp
1>imgui_widgets.cpp
1>Generating Code...
1>ConsoleApplication2.obj : error LNK2019: unresolved external symbol _Direct3DCreate9#4 referenced in function "bool __cdecl CreateDeviceD3D(struct HWND__ *)" (?CreateDeviceD3D##YA_NPAUHWND__###Z)
1>imgui_impl_win32.obj : error LNK2019: unresolved external symbol _XInputGetState#8 referenced in function "void __cdecl ImGui_ImplWin32_UpdateGamepads(void)" (?ImGui_ImplWin32_UpdateGamepads##YAXXZ)
1>imgui_impl_win32.obj : error LNK2019: unresolved external symbol _XInputGetCapabilities#12 referenced in function "void __cdecl ImGui_ImplWin32_UpdateGamepads(void)" (?ImGui_ImplWin32_UpdateGamepads##YAXXZ)
1>C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x64\xinput.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'
1>C:\Users\Logan\source\repos\ConsoleApplication2\Debug\ConsoleApplication2.exe : fatal error LNK1120: 3 unresolved externals
1>Done building project "ConsoleApplication2.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I am getting a boost linking error when using both PCL and cgal in a project (as well as a redefinition warning). PCL and cgal examples both run fine so the installation should be good.
My program to test looks like this:
#include <iostream>
#include <CGAL/Simple_cartesian.h>
#include <pcl/visualization/cloud_viewer.h>
int
main()
{
std::cout << "Test "<< std::endl;
return 0;
}
The error that I get is pasted below:
1>------ Build started: Project: PC_Svr2, Configuration: Debug x64 ------
1>cloud_viewer.cpp
1>Unknown compiler version - please run the configure tests and report the results
1>C:\Program Files\PCL 1.8.1\include\pcl-1.8\pcl/visualization/boost.h(51,1): warning C4005: 'BOOST_PARAMETER_MAX_ARITY': macro redefinition
1>C:\dev\CGAL-5.0.2\include\CGAL/config.h(115): message : see previous definition of 'BOOST_PARAMETER_MAX_ARITY'
1>cloud_viewer.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class boost::system::error_category const & __cdecl boost::system::system_category(void)" (__imp_?system_category#system#boost##YAAEBVerror_category#12#XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'native_ecat''(void)" (??__Enative_ecat#system#boost##YAXXZ)
1>cloud_viewer.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (__imp_?generic_category#system#boost##YAAEBVerror_category#12#XZ) referenced in function "public: __cdecl boost::thread_exception::thread_exception(int,char const *)" (??0thread_exception#boost##QEAA#HPEBD#Z)
1>C:\Users\PCL_Project\PC_svr2\build\Debug\PC_Svr2.exe : fatal error LNK1120: 2 unresolved externals
1>Done building project "PC_Svr2.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
When I exclude the PCL include the program runs fine, but when I exclude the cgal include i get a very similar error:
1>------ Build started: Project: PC_Svr2, Configuration: Debug x64 ------
1>cloud_viewer.cpp
1>Unknown compiler version - please run the configure tests and report the results
1>cloud_viewer.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class boost::system::error_category const & __cdecl boost::system::system_category(void)" (__imp_?system_category#system#boost##YAAEBVerror_category#12#XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'native_ecat''(void)" (??__Enative_ecat#system#boost##YAXXZ)
1>cloud_viewer.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (__imp_?generic_category#system#boost##YAAEBVerror_category#12#XZ) referenced in function "public: __cdecl boost::thread_exception::thread_exception(int,char const *)" (??0thread_exception#boost##QEAA#HPEBD#Z)
1>C:\Users\PCL_Project\PC_svr2\build\Debug\PC_Svr2.exe : fatal error LNK1120: 2 unresolved externals
1>Done building project "PC_Svr2.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
I am not sure but I suspect that it might have something to do with my CMakeLists.txt, which I will also paste below:
cmake_minimum_required(VERSION 3.1...3.15)
project(PC_Svr2)
find_package(CGAL QUIET)
find_package(PCL 1.2 REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
add_executable (PC_Svr2 cloud_viewer.cpp)
target_link_libraries(PC_Svr2 CGAL::CGAL ${PCL_LIBRARIES})
Does anyone know what the problem might be?
I seem to have found the answer. It seems to have been a problem with boost and making the boost library static solved the problem. (I found this question about the same problem: C++ using two incompatible libraries together, what are the options?)
So to fix it check the Advanced option in the CMake GUI and then under CGAL check CGAL_Boost_USE_STATIC_LIBS.
You are misisng boost in your CMakeLists.txt. Your test runs fine without PCL because CGAL's header does not need boost, and I guess PCL's does.
You need to add
find_package(Boost COMPONENTS system) and
target_link_libraries(PC_Svr2 CGAL::CGAL ${PCL_LIBRARIES} Boost::system).
It should be ok after that.
If not, check what components you need and change your configuration file accordingly.
Note that most of the time, a linking error means a problem with target_link_libraries(), either it is missing, or the values given to it are wrong.
so I'm trying to write a program in Visual Studio (in C++) with use of libsndfile library, but I can't make it work. I have installed this library with vcpkg and when i try to run program from this site http://digitalsoundandmusic.com/5-3-3-reading-and-writing-formatted-audio-files-in-c/ I get 3 errors:
1>------ Build started: Project: ConsoleApplication4, Configuration: Debug Win32 ------
1>ConsoleApplication4.cpp
1>libsndfile.lib(flac.obj) : error LNK2001: unresolved external symbol _FLAC__StreamDecoderErrorStatusString
1>libsndfile.lib(flac.obj) : error LNK2001: unresolved external symbol _FLAC__StreamEncoderInitStatusString
1>C:\Users\asd\source\repos\ConsoleApplication4\Debug\ConsoleApplication4.exe : fatal error LNK1120: 2 unresolved externals
1>Done building project "ConsoleApplication4.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I tried also manually add this library but I had 68 errors similar to those above. Please, help me find solution. Thank you.
So, I'm trying to use SDL for the first time and so far it has been a complete mess! I'm trying to get this to run, but everything that I have tried has failed. I have been following all the correct guides but it still will not run!
I am using Visual Studio Ultimate 2010.
This is all the code that I am trying to run:
#include "SDL.h"
#include <iostream>
int main(int argc, char* args[]) {
// Start SDL
SDL_Init(SDL_INIT_EVERYTHING);
std::cout << "SDL has been initialized!\n";
// Quit SDL
SDL_Quit();
std::cout << "SDL has quit!" << std::endl;
return 0x0;
}
The errors that the compiler yaks back are driving me nuts! Here they are:
1>------ Build started: Project: SDL_TEST, Configuration: Debug Win32 ------
1>Build started 7/6/2013 1:21:45 PM.
1>InitializeBuildStatus:
1> Touching "Debug\SDL_TEST.unsuccessfulbuild".
1>ClCompile:
1> main.cpp
1>main.obj : error LNK2019: unresolved external symbol _SDL_Quit referenced in function _SDL_main
1>main.obj : error LNK2019: unresolved external symbol _SDL_Init referenced in function _SDL_main
1>MSVCRT.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
1>C:\Users\Tux\documents\visual studio 2010\Projects\SDL_TEST\Debug\SDL_TEST.exe : fatal error LNK1120: 3 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.59
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Compilation fails because you are not linking with the correct libraries. You have linked with the 64bit libraries but you are trying to build a Win32 binary:
1>------ Build started: Project: SDL_TEST, Configuration: Debug Win32 ------
Linking with the 32bit libraries or switching to a Win64 binary should resolve your problem.
I am currently working on converting some of my applications to C++, and for that i have decided to use openGL, as ive got some experience with it from other platforms.
But getting this to compile in x64 seems to be quite a lot of hassle. To check if my linking stuff is working i am just trying to compile this tutorial:
http://www.opengl-tutorial.org/beginners-tutorials/tutorial-1-opening-a-window/
But as you can see, i failed miserably. I have downloaded and installed:
freeglut
GLM
GLFW
GLEW
The issue clearly seems to lay within GLFW. I am using Visual express c++ 2010.
I installed GLFW like this:
GLFW.dll (System32)
glfw.h (C:\Program Files\Microsoft SDKs\Windows\v7.1\Include\gl)
GLFW.lib (C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib\x64)
GLFWDLL.lib (C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib\x64)
My linker:
kernel32.lib;glu32.lib;glew32.lib;GLFW.lib;GLFWDLL.lib;opengl32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
Output:
1>------ Build started: Project: Spacecraft, Configuration: Debug x64 ------
1> Main.cpp
1>Main.obj : error LNK2019: unresolved external symbol __imp_glfwGetWindowParam referenced in function main
1>Main.obj : error LNK2019: unresolved external symbol __imp_glfwGetKey referenced in function main
1>Main.obj : error LNK2019: unresolved external symbol __imp_glfwSwapBuffers referenced in function main
1>Main.obj : error LNK2019: unresolved external symbol __imp_glfwEnable referenced in function main
1>Main.obj : error LNK2019: unresolved external symbol __imp_glfwSetWindowTitle referenced in function main
1>Main.obj : error LNK2019: unresolved external symbol __imp_glfwTerminate referenced in function main
1>Main.obj : error LNK2019: unresolved external symbol __imp_glfwOpenWindow referenced in function main
1>Main.obj : error LNK2019: unresolved external symbol __imp_glfwOpenWindowHint referenced in function main
1>Main.obj : error LNK2019: unresolved external symbol __imp_glfwInit referenced in function main
1>c:\users\leif andreas\documents\visual studio 2010\Projects\Spacecraft\x64\Debug\Spacecraft.exe : fatal error LNK1120: 9 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
And finally, my includes:
// Include standard headers
#include <stdio.h>
#include <stdlib.h>
// Include GLEW
#include <gl/glew.h>
#include <gl/glut.h>
// Include GLFW
#include <gl/glfw.h>
// Include GLM
#include <glm/glm.hpp>
using namespace glm;