I have a problem while compiling CGAL
I followed the steps here :
http://www.cse.msu.edu/~ytong/CGAL_installation.ppt
but when I reach at building CGAL .sln step
it show the following errors:
here
output:
1>------ Build started: Project: CGAL, Configuration: Debug Win32 ------
1> Building Custom Rule C:/dev/CGAL-4.9.1/src/CGAL/CMakeLists.txt
1> CMake does not need to re-run because C:\dev\CGAL-4.9.1\build\src\CGAL\CMakeFiles\generate.stamp is up-to-date.
1> all_files.cpp
1> Creating library C:/dev/CGAL-4.9.1/build/lib/Debug/CGAL-vc120-mt-gd-4.9.1.lib and object C:/dev/CGAL-4.9.1/build/lib/Debug/CGAL-vc120-mt-gd-4.9.1.exp
1>all_files.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##YAABVerror_category#12#XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'native_ecat''(void)" (??__Enative_ecat#system#boost##YAXXZ)
1>all_files.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##YAABVerror_category#12#XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'errno_ecat''(void)" (??__Eerrno_ecat#system#boost##YAXXZ)
1>C:\dev\CGAL-4.9.1\build\bin\Debug\CGAL-vc120-mt-gd-4.9.1.dll : fatal error LNK1120: 2 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
We are currently at CGAL 4.12 so please upgrade and follow official installation instructions.
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.
I recently wanted to start learning assembly, but I have been having some problem setting up my project to build.
What I want to have is a C++ and assembly project, but it is currently not working. My assembly code shown below builds just fine:
ExitProcess PROTO
.data
.code
main proc
mov rax, 8
mov rcx, 0
call ExitProcess
main endp
end
but the moment I add a cpp file to my project I get a load of linker errors:
void ToDo()
{
int i = 0;
}
Errors:
1>------ Build started: Project: AssemblyTest, Configuration: Debug x64 ------
1> test.cpp
1>MSVCRTD.lib(_init_.obj) : error LNK2019: unresolved external symbol _CrtDbgReport referenced in function _CRT_RTC_INIT
1>MSVCRTD.lib(_init_.obj) : error LNK2019: unresolved external symbol _CrtDbgReportW referenced in function _CRT_RTC_INITW
1>MSVCRTD.lib(_error_.obj) : error LNK2019: unresolved external symbol __stdio_common_vsprintf_s referenced in function _vsprintf_s_l
1>MSVCRTD.lib(_error_.obj) : error LNK2001: unresolved external symbol __C_specific_handler
1>MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol _wmakepath_s referenced in function "int __cdecl GetPdbDllPathFromFilePath(wchar_t const *,wchar_t *,unsigned __int64)" (?GetPdbDllPathFromFilePath##YAHPEB_WPEA_W_K#Z)
1>MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol _wsplitpath_s referenced in function "int __cdecl GetPdbDllPathFromFilePath(wchar_t const *,wchar_t *,unsigned __int64)" (?GetPdbDllPathFromFilePath##YAHPEB_WPEA_W_K#Z)
1>MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol wcscpy_s referenced in function "int __cdecl GetPdbDllPathFromFilePath(wchar_t const *,wchar_t *,unsigned __int64)" (?GetPdbDllPathFromFilePath##YAHPEB_WPEA_W_K#Z)
1>MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol __vcrt_GetModuleFileNameW referenced in function "struct HINSTANCE__ * __cdecl GetPdbDll(void)" (?GetPdbDll##YAPEAUHINSTANCE__##XZ)
1>MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol __vcrt_GetModuleHandleW referenced in function "struct HINSTANCE__ * __cdecl GetPdbDll(void)" (?GetPdbDll##YAPEAUHINSTANCE__##XZ)
1>MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol __vcrt_LoadLibraryExW referenced in function "struct HINSTANCE__ * __cdecl GetPdbDll(void)" (?GetPdbDll##YAPEAUHINSTANCE__##XZ)
1>C:\Users\***\Desktop\AssemblyTest\x64\Debug\AssemblyTest.exe : fatal error LNK1120: 10 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Does anybody know what is wrong with my setup and how to fix it?
You're linking your project with only part of the C runtime (CRT) libary, msvcrtd.lib. You also need to link with the libraries vcruntimed.lib and ucrtd.lib. The former is part of Visual Studio 2015 itself while the later is part of the Windows 10 SDK that was installed along Visual Studio. Normally C++ projects automatically link with these libraries, but apparently your project is setup not to.
You may be following instructions meant for an older version of Visual Studio which only required linking with one CRT library file. This changed due to a refactoring of the CRT with Visual Studio 2015.
Getting the following error when building:
1>------ Rebuild All started: Project: hw2_hci, Configuration: Release Win32 ------
1> Source.cpp
1>Source.cpp(373): warning C4551: function call missing argument list
1>Source.cpp(627): warning C4551: function call missing argument list
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>glfw3.lib(wgl_context.obj) : error LNK2001: unresolved external symbol __imp__DescribePixelFormat#16
1>glfw3.lib(wgl_context.obj) : error LNK2001: unresolved external symbol __imp__SetPixelFormat#12
1>glfw3.lib(wgl_context.obj) : error LNK2001: unresolved external symbol __imp__SwapBuffers#4
1>glfw3.lib(win32_monitor.obj) : error LNK2001: unresolved external symbol __imp__CreateDCW#16
1>glfw3.lib(win32_gamma.obj) : error LNK2001: unresolved external symbol __imp__CreateDCW#16
1>glfw3.lib(win32_monitor.obj) : error LNK2001: unresolved external symbol __imp__DeleteDC#4
1>glfw3.lib(win32_gamma.obj) : error LNK2001: unresolved external symbol __imp__DeleteDC#4
1>glfw3.lib(win32_monitor.obj) : error LNK2001: unresolved external symbol __imp__GetDeviceCaps#8
1>glfw3.lib(win32_gamma.obj) : error LNK2001: unresolved external symbol __imp__GetDeviceGammaRamp#8
1>glfw3.lib(win32_gamma.obj) : error LNK2001: unresolved external symbol __imp__SetDeviceGammaRamp#8
1>C:\Users\student\Documents\VSTest\hw2_hci\Release\hw2_hci.exe : fatal error LNK1120: 8 unresolved externals
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
Added the following, same error:
And this:
This problem occurs when I Use MFC in a Static Library. Why is this happening?
As someone suggested to go to this page, I added the following as suggested without it working.
And the error:
After adding gdi32.lib i got the following error:
1> Finished generating code
1>MSVCRT.lib(MSVCR110.dll) : error LNK2005: _calloc already defined in LIBCMT.lib(calloc.obj)
1>MSVCRT.lib(MSVCR110.dll) : error LNK2005: _free already defined in LIBCMT.lib(free.obj)
1>MSVCRT.lib(MSVCR110.dll) : error LNK2005: _realloc already defined in LIBCMT.lib(realloc.obj)
1>MSVCRT.lib(MSVCR110.dll) : error LNK2005: __strdup already defined in LIBCMT.lib(strdup.obj)
1>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info##AAE#ABV0##Z) already defined in LIBCMT.lib(typinfo.obj)
1>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info##AAEAAV0#ABV0##Z) already defined in LIBCMT.lib(typinfo.obj)
1>C:\Users\student\Documents\VSTest\hw2_hci\Release\hw2_hci.exe : fatal error LNK1169: one or more multiply defined symbols found
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
What's happening is that the default libraries specified by one or more objects (probably in a library you're using) is asking to be linked with an runtime library that isn't the same as what your project is using.
The docs on LNK4098 are reasonably clear about what's going on and how to troubleshoot the problem.
Don't add the libraries to ignore in the 'additional options', add them under Linker/Input/ Ignore specific default libraries' (I see you already have glfw3.lib there, just add libcmt.lib separated by a semicolon).
I am getting the below link errors.
1>------ Build started: Project: NowHook, Configuration: Debug Win32 ------
1>Compiling...
1>NowHook.CPP
1>Linking...
1>NowHook.obj : error LNK2019: unresolved external symbol __imp__VirtualProtect#16 referenced in function "void __cdecl
1>NowHook.obj : error LNK2019: unresolved external symbol __imp__GetProcAddress#8 referenced in function "void __cdecl
1>NowHook.obj : error LNK2019: unresolved external symbol __imp__LoadLibraryA#4 referenced in function "void __cdecl HookSend(void)" (?HookSend##YAXXZ)
1>C:\Users\JAGAN\Documents\Visual Studio 2008\Projects\HookNow\Debug\NowHook.dll :
fatal error LNK1120: 3 unresolved externals
1>Build log was saved at "file://c:\Users\JAGAN\Documents\Visual Studio 2008\Projects
I have included
1) Linker/General/AdditionalLibraryDirectories
2) Linker/Input/Additional Dependencies
You are missing kernel32.lib in your Linker/Input/Additional Dependencies
Make sure you are setting the Additional Dependencies for "All Configurations" and "All Platforms".