LNK2028 LNK2029 when compiling static c++ library in managed c++/clr - c++-cli

As i am pretty much out of ideas and the google results by now have reached the point where they hit ~10 and less, i now turn here in hope of seeing the answer or at least a clue that leads me to the actual solution.
I am creating a project that can be distributed as executable, non-static library and static library.
I want to use the library in a WPF project (C#) which is why i created a simple CLR wrapper.
It all worked very well up until the most recent change introduced into the base-library.
Now, i get linkage errors (5 in total) on all calls to the "main" class in the library project:
1>wrapper.obj : error LNK2028: unresolved token (0A0016EB) "public: class std::vector<struct sqf::diagnostics::stackdump,class std::allocator<struct sqf::diagnostics::stackdump> > __thiscall sqf::vmstack::dump_callstack_diff(class std::shared_ptr<class sqf::callstack>)" (?dump_callstack_diff#vmstack#sqf##$$FQAE?AV?$vector#Ustackdump#diagnostics#sqf##V?$allocator#Ustackdump#diagnostics#sqf###std###std##V?$shared_ptr#Vcallstack#sqf###4##Z) referenced in function "public: class std::vector<struct sqf::diagnostics::stackdump,class std::allocator<struct sqf::diagnostics::stackdump> > __thiscall SqfVm::wrapper::get_stackdump(void)" (?get_stackdump#wrapper#SqfVm##$$FQAE?AV?$vector#Ustackdump#diagnostics#sqf##V?$allocator#Ustackdump#diagnostics#sqf###std###std##XZ)
1>wrapper.obj : error LNK2028: unresolved token (0A0016F5) "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall sqf::virtualmachine::preprocess(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,bool &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?preprocess#virtualmachine#sqf##$$FQAE?AV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##V34#AA_N0#Z) referenced in function "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall SqfVm::wrapper::preprocess(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,bool &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?preprocess#wrapper#SqfVm##$$FQAE?AV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##V34#AA_N0#Z)
1>wrapper.obj : error LNK2028: unresolved token (0A0016F6) "public: struct sqf::parse::astnode __thiscall sqf::virtualmachine::parse_sqf_cst(class std::basic_string_view<char,struct std::char_traits<char> >,bool &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?parse_sqf_cst#virtualmachine#sqf##$$FQAE?AUastnode#parse#2#V?$basic_string_view#DU?$char_traits#D#std###std##AA_NV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##6##Z) referenced in function "public: struct sqf::parse::astnode __thiscall sqf::virtualmachine::parse_sqf_cst(class std::basic_string_view<char,struct std::char_traits<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?parse_sqf_cst#virtualmachine#sqf##$$FQAE?AUastnode#parse#2#V?$basic_string_view#DU?$char_traits#D#std###std##V?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##6##Z)
1>wrapper.obj : error LNK2019: unresolved external symbol "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall sqf::virtualmachine::preprocess(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,bool &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?preprocess#virtualmachine#sqf##$$FQAE?AV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##V34#AA_N0#Z) referenced in function "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall SqfVm::wrapper::preprocess(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,bool &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?preprocess#wrapper#SqfVm##$$FQAE?AV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##V34#AA_N0#Z)
1>wrapper.obj : error LNK2019: unresolved external symbol "public: struct sqf::parse::astnode __thiscall sqf::virtualmachine::parse_sqf_cst(class std::basic_string_view<char,struct std::char_traits<char> >,bool &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?parse_sqf_cst#virtualmachine#sqf##$$FQAE?AUastnode#parse#2#V?$basic_string_view#DU?$char_traits#D#std###std##AA_NV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##6##Z) referenced in function "public: struct sqf::parse::astnode __thiscall sqf::virtualmachine::parse_sqf_cst(class std::basic_string_view<char,struct std::char_traits<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?parse_sqf_cst#virtualmachine#sqf##$$FQAE?AUastnode#parse#2#V?$basic_string_view#DU?$char_traits#D#std###std##V?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##6##Z)
1>wrapper.obj : error LNK2019: unresolved external symbol "public: class std::vector<struct sqf::diagnostics::stackdump,class std::allocator<struct sqf::diagnostics::stackdump> > __thiscall sqf::vmstack::dump_callstack_diff(class std::shared_ptr<class sqf::callstack>)" (?dump_callstack_diff#vmstack#sqf##$$FQAE?AV?$vector#Ustackdump#diagnostics#sqf##V?$allocator#Ustackdump#diagnostics#sqf###std###std##V?$shared_ptr#Vcallstack#sqf###4##Z) referenced in function "public: class std::vector<struct sqf::diagnostics::stackdump,class std::allocator<struct sqf::diagnostics::stackdump> > __thiscall SqfVm::wrapper::get_stackdump(void)" (?get_stackdump#wrapper#SqfVm##$$FQAE?AV?$vector#Ustackdump#diagnostics#sqf##V?$allocator#Ustackdump#diagnostics#sqf###std###std##XZ)
1>wrapper.obj : error LNK2019: unresolved external symbol "public: __thiscall sqf::virtualmachine::virtualmachine(class Logger &,unsigned __int64)" (??0virtualmachine#sqf##QAE#AAVLogger##_K#Z) referenced in function "public: __thiscall sqf::virtualmachine::virtualmachine(class Logger &)" (??0virtualmachine#sqf##QAE#AAVLogger###Z)
1>D:\Git\SQFvm\clrBridge\Release\clrBridge.dll : fatal error LNK1120: 7 unresolved externals
The projects, can both be found here:
The C++ Project https://github.com/SQFvm/vm
The C++/CLR Project https://github.com/SQFvm/ClrBridge
Was able to get rid of the LNK2028 issues by adding another separation layer (wrapper.cpp & wrapper.h) and then putting a #pragma unmanaged at the top of the cpp file.
Only the LNK2019 issues are left now

For those users who may find this question in the future, here is what helped me:
Separating all classes
Adding #pragma managed to the an unmanaged wrapper for the actual class (got rid of the LNK2028)
One of the following commits:
Moving invalidly placed C method out of external "C" that is not involved in any way normally to the static library built but MAY intefere with the CLR build process as the header still was there
Altering the arangement of the constructor
Hope this helps you.

Related

What I doing wrong when i build Live555-MediaServer?

I get an error when I compile MediaSever
Rebuild started...
1>------ Rebuild All started: Project: mediaServer, Configuration: Debug x64 ------
1>DynamicRTSPServer.cpp
1>E:\SS\sy\C\live555\mediaServer\DynamicRTSPServer.cpp(193,53): warning C4267: 'initializing': conversion from 'size_t' to 'unsigned int', possible loss of data
1>live555MediaServer.cpp
1>Generating Code...
1>BasicUsageEnvironment.lib(BasicUsageEnvironment.obj) : error LNK2019: unresolved external symbol "public: virtual void __cdecl UsageEnvironment::internalError(void)" (?internalError#UsageEnvironment##UEAAXXZ) referenced in function "protected: __cdecl BasicUsageEnvironment::BasicUsageEnvironment(class TaskScheduler &)" (??0BasicUsageEnvironment##IEAA#AEAVTaskScheduler###Z)
1>BasicUsageEnvironment.lib(BasicUsageEnvironment0.obj) : error LNK2001: unresolved external symbol "public: virtual void __cdecl UsageEnvironment::internalError(void)" (?internalError#UsageEnvironment##UEAAXXZ)
1>BasicUsageEnvironment.lib(BasicTaskScheduler.obj) : error LNK2001: unresolved external symbol "public: virtual void __cdecl TaskScheduler::rescheduleDelayedTask(void * &,__int64,void (__cdecl*)(void *),void *)" (?rescheduleDelayedTask#TaskScheduler##UEAAXAEAPEAX_JP6AXPEAX#Z2#Z)
1>BasicUsageEnvironment.lib(BasicTaskScheduler0.obj) : error LNK2001: unresolved external symbol "public: virtual void __cdecl TaskScheduler::rescheduleDelayedTask(void * &,__int64,void (__cdecl*)(void *),void *)" (?rescheduleDelayedTask#TaskScheduler##UEAAXAEAPEAX_JP6AXPEAX#Z2#Z)
1>BasicUsageEnvironment.lib(BasicTaskScheduler.obj) : error LNK2001: unresolved external symbol "public: virtual void __cdecl TaskScheduler::internalError(void)" (?internalError#TaskScheduler##UEAAXXZ)
1>BasicUsageEnvironment.lib(BasicTaskScheduler0.obj) : error LNK2001: unresolved external symbol "public: virtual void __cdecl TaskScheduler::internalError(void)" (?internalError#TaskScheduler##UEAAXXZ)
1>BasicUsageEnvironment.lib(BasicUsageEnvironment0.obj) : error LNK2019: unresolved external symbol "protected: __cdecl UsageEnvironment::UsageEnvironment(class TaskScheduler &)" (??0UsageEnvironment##IEAA#AEAVTaskScheduler###Z) referenced in function "protected: __cdecl BasicUsageEnvironment0::BasicUsageEnvironment0(class TaskScheduler &)" (??0BasicUsageEnvironment0##IEAA#AEAVTaskScheduler###Z)
1>BasicUsageEnvironment.lib(BasicUsageEnvironment0.obj) : error LNK2019: unresolved external symbol "protected: virtual __cdecl UsageEnvironment::~UsageEnvironment(void)" (??1UsageEnvironment##MEAA#XZ) referenced in function "int `protected: __cdecl BasicUsageEnvironment0::BasicUsageEnvironment0(class TaskScheduler &)'::`1'::dtor$0" (?dtor$0#?0???0BasicUsageEnvironment0##IEAA#AEAVTaskScheduler###Z#4HA)
1>BasicUsageEnvironment.lib(BasicTaskScheduler0.obj) : error LNK2019: unresolved external symbol "public: virtual __cdecl TaskScheduler::~TaskScheduler(void)" (??1TaskScheduler##UEAA#XZ) referenced in function "int `protected: __cdecl BasicTaskScheduler0::BasicTaskScheduler0(void)'::`1'::dtor$0" (?dtor$0#?0???0BasicTaskScheduler0##IEAA#XZ#4HA)
1>BasicUsageEnvironment.lib(BasicTaskScheduler0.obj) : error LNK2019: unresolved external symbol "protected: __cdecl TaskScheduler::TaskScheduler(void)" (??0TaskScheduler##IEAA#XZ) referenced in function "protected: __cdecl BasicTaskScheduler0::BasicTaskScheduler0(void)" (??0BasicTaskScheduler0##IEAA#XZ)
1>E:\SS\sy\C\live555\x64\Debug\mediaServer.exe : fatal error LNK1120: 7 unresolved externals
1>Done building project "mediaServer.vcxproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
This is my lib configuration:
I searched Google and StackOverflow and found no related issues

unresolved external symbol with cmake

I am trying to create a .dll with cmake .Below is my cmakelists.txt
# This is the root ITK CMakeLists file.
cmake_minimum_required(VERSION 2.8.9)
if(COMMAND CMAKE_POLICY)
cmake_policy(SET CMP0003 NEW)
endif()
SET(BUILD_SHARED_LIBS TRUE)
SET(ITK_LIBRARIES
ITKIO
ITKCommon
ITKNumerics
ITKStatistics
ITKBasicFilters
)
# The header files
SET(HEADERS
itkLookAtTransformInitializer.h
itkObliqueSectionImageFilter.h
obliquePlane.h
)
# The implementation files
SET(SOURCES
itkLookAtTransformInitializer.txx
itkObliqueSectionImageFilter.txx
main.cxx
obliquePlane.cpp
)
# Find ITK.
find_package(ITK REQUIRED)
include(${ITK_USE_FILE})
# Add this as include directory
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}
${SOURCE_PATH}
${VXL_INCLUDE_DIRS}
)
LINK_DIRECTORIES(${ITK_LIBRARIES})
# Main library
#ADD_EXECUTABLE(LookAtMain ${HEADERS} ${SOURCES})
ADD_LIBRARY(ObliquePlane SHARED ${HEADERS} ${SOURCES})
TARGET_LINK_LIBRARIES(ObliquePlane ${ITK_LIBRARIES})
I am new to both cmake and itk I am getting the following error when i build it:
obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::GE5ImageIOFactoryRegister__Private(void)" (__imp_?GE5ImageIOFactoryRegister__Private#itk##YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" (??__EImageIOFactoryRegisterRegisterList#?A0x44466dff#itk##YAXXZ)
2>obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::GE4ImageIOFactoryRegister__Private(void)" (__imp_?GE4ImageIOFactoryRegister__Private#itk##YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" (??__EImageIOFactoryRegisterRegisterList#?A0x44466dff#itk##YAXXZ)
2>obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::MRCImageIOFactoryRegister__Private(void)" (__imp_?MRCImageIOFactoryRegister__Private#itk##YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" (??__EImageIOFactoryRegisterRegisterList#?A0x44466dff#itk##YAXXZ)
2>obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::MetaImageIOFactoryRegister__Private(void)" (__imp_?MetaImageIOFactoryRegister__Private#itk##YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" (??__EImageIOFactoryRegisterRegisterList#?A0x44466dff#itk##YAXXZ)
2>obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::BioRadImageIOFactoryRegister__Private(void)" (__imp_?BioRadImageIOFactoryRegister__Private#itk##YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" (??__EImageIOFactoryRegisterRegisterList#?A0x44466dff#itk##YAXXZ)
2>obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::StimulateImageIOFactoryRegister__Private(void)" (__imp_?StimulateImageIOFactoryRegister__Private#itk##YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" (??__EImageIOFactoryRegisterRegisterList#?A0x44466dff#itk##YAXXZ)
2>obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::VTKImageIOFactoryRegister__Private(void)" (__imp_?VTKImageIOFactoryRegister__Private#itk##YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" (??__EImageIOFactoryRegisterRegisterList#?A0x44466dff#itk##YAXXZ)
2>obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::TIFFImageIOFactoryRegister__Private(void)" (__imp_?TIFFImageIOFactoryRegister__Private#itk##YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" (??__EImageIOFactoryRegisterRegisterList#?A0x44466dff#itk##YAXXZ)
2>obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::PNGImageIOFactoryRegister__Private(void)" (__imp_?PNGImageIOFactoryRegister__Private#itk##YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" (??__EImageIOFactoryRegisterRegisterList#?A0x44466dff#itk##YAXXZ)
2>obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::LSMImageIOFactoryRegister__Private(void)" (__imp_?LSMImageIOFactoryRegister__Private#itk##YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" (??__EImageIOFactoryRegisterRegisterList#?A0x44466dff#itk##YAXXZ)
2>obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::BMPImageIOFactoryRegister__Private(void)" (__imp_?BMPImageIOFactoryRegister__Private#itk##YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" (??__EImageIOFactoryRegisterRegisterList#?A0x44466dff#itk##YAXXZ)
2>obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::GDCMImageIOFactoryRegister__Private(void)" (__imp_?GDCMImageIOFactoryRegister__Private#itk##YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" (??__EImageIOFactoryRegisterRegisterList#?A0x44466dff#itk##YAXXZ)
2>obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::JPEGImageIOFactoryRegister__Private(void)" (__imp_?JPEGImageIOFactoryRegister__Private#itk##YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" (??__EImageIOFactoryRegisterRegisterList#?A0x44466dff#itk##YAXXZ)
2>obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::HDF5ImageIOFactoryRegister__Private(void)" (__imp_?HDF5ImageIOFactoryRegister__Private#itk##YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" (??__EImageIOFactoryRegisterRegisterList#?A0x44466dff#itk##YAXXZ)
2>obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::GiplImageIOFactoryRegister__Private(void)" (__imp_?GiplImageIOFactoryRegister__Private#itk##YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" (??__EImageIOFactoryRegisterRegisterList#?A0x44466dff#itk##YAXXZ)
2>obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::NrrdImageIOFactoryRegister__Private(void)" (__imp_?NrrdImageIOFactoryRegister__Private#itk##YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" (??__EImageIOFactoryRegisterRegisterList#?A0x44466dff#itk##YAXXZ)
2>obliquePlane.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl itk::NiftiImageIOFactoryRegister__Private(void)" (__imp_?NiftiImageIOFactoryRegister__Private#itk##YAXXZ) referenced in function "void __cdecl itk::`anonymous namespace'::`dynamic initializer for 'ImageIOFactoryRegisterRegisterList''(void)" (??__EImageIOFactoryRegisterRegisterList#?A0x44466
Correct usage of find_package(ITK):
# All needed ITK components should be listed in find_package() call
find_package(ITK REQUIRED COMPONENTS
ITKIO
ITKCommon
ITKNumerics
ITKStatistics
ITKBasicFilters
)
# These variables are set now:
# ITK_LIBRARIES = Libraries to link
# ITK_INCLUDE_DIRS = Header file search path
# ITK_LIBRARY_DIRS = Library search path (for outside dependencies)
# ITK_RUNTIME_LIBRARY_DIRS = Runtime linker search path
#
# ITK_USE_FILE - The location of the UseITK.cmake file.
# This call performs all settings except ITK_LIBRARIES,
# which should be passed to target_link_libraries() call.
include(${ITK_USE_FILE})
ADD_LIBRARY(ObliquePlane SHARED <...>)
TARGET_LINK_LIBRARIES(ObliquePlane ${ITK_LIBRARIES})

Trying to compile Nite2 sample in OpenNI

I am new in Kinect SDK, therefore I am asking for your help solving this problem:
1>------ Build started: Project: UserViewer, Configuration: Debug
Win32 ------
1>Viewer.obj : error LNK2019: unresolved external symbol
_imp_oniInitialize referenced in function "public: static enum openni::Status __cdecl openni::OpenNI::initialize(void)"
(?initialize#OpenNI#openni##SA?AW4Status#2#XZ)
1>Viewer.obj : error LNK2019: unresolved external symbol
_imp_oniShutdown referenced in function "public: static void __cdecl openni::OpenNI::shutdown(void)" (?shutdown#OpenNI#openni##SAXXZ)
1>Viewer.obj : error LNK2019: unresolved external symbol
_imp_oniGetExtendedError referenced in function "public: static char const * __cdecl openni::OpenNI::getExtendedError(void)"
(?getExtendedError#OpenNI#openni##SAPBDXZ)
1>Viewer.obj : error LNK2019: unresolved external symbol
_imp_oniDeviceOpen referenced in function "public: enum openni::Status __thiscall openni::Device::open(char const *)"
(?open#Device#openni##QAE?AW4Status#2#PBD#Z)
1>Viewer.obj : error LNK2019: unresolved external symbol
_imp_oniDeviceClose referenced in function "public: void __thiscall openni::Device::close(void)" (?close#Device#openni##QAEXXZ)
1>Viewer.obj : error LNK2019: unresolved external symbol
_imp_oniDeviceGetInfo referenced in function "private: enum openni::Status __thiscall openni::Device::_setHandle(struct _OniDevice
*)" (?_setHandle#Device#openni##AAE?AW4Status#2#PAU_OniDevice###Z)
1>Viewer.obj : error LNK2019: unresolved external symbol
_imp_oniDeviceIsPropertySupported referenced in function "public: bool __thiscall openni::Device::isPropertySupported(int)const "
(?isPropertySupported#Device#openni##QBE_NH#Z)
1>Viewer.obj : error LNK2019: unresolved external symbol
_imp_oniDeviceIsCommandSupported referenced in function "public: bool __thiscall openni::Device::isCommandSupported(int)const "
(?isCommandSupported#Device#openni##QBE_NH#Z)
1>Viewer.obj : error LNK2019: unresolved external symbol
_imp_oniFrameAddRef referenced in function "public: void __thiscall openni::VideoFrameRef::_setFrame(struct OniFrame *)"
(?_setFrame#VideoFrameRef#openni##QAEXPAUOniFrame###Z)
1>Viewer.obj : error LNK2019: unresolved external symbol
_imp_oniFrameRelease referenced in function "public: void __thiscall openni::VideoFrameRef::release(void)"
(?release#VideoFrameRef#openni##QAEXXZ)
1>Viewer.obj : error LNK2019: unresolved external symbol
_imp_niteInitialize referenced in function "public: static enum nite::Status __cdecl nite::NiTE::initialize(void)"
(?initialize#NiTE#nite##SA?AW4Status#2#XZ)
1>Viewer.obj : error LNK2019: unresolved external symbol
_imp_niteShutdown referenced in function "public: static void __cdecl nite::NiTE::shutdown(void)" (?shutdown#NiTE#nite##SAXXZ)
1>Viewer.obj : error LNK2019: unresolved external symbol
_imp_niteInitializeUserTracker referenced in function "public: enum nite::Status __thiscall nite::UserTracker::create(class openni::Device
*)" (?create#UserTracker#nite##QAE?AW4Status#2#PAVDevice#openni###Z)
1>Viewer.obj : error LNK2019: unresolved external symbol
_imp_niteInitializeUserTrackerByDevice referenced in function "public: enum nite::Status __thiscall nite::UserTracker::create(class
openni::Device *)"
(?create#UserTracker#nite##QAE?AW4Status#2#PAVDevice#openni###Z)
1>Viewer.obj : error LNK2019: unresolved external symbol
_imp_niteShutdownUserTracker referenced in function "public: void __thiscall nite::UserTracker::destroy(void)" (?destroy#UserTracker#nite##QAEXXZ)
1>Viewer.obj : error LNK2019: unresolved external symbol
_imp_niteStartSkeletonTracking referenced in function "public: enum nite::Status __thiscall
nite::UserTracker::startSkeletonTracking(short)"
(?startSkeletonTracking#UserTracker#nite##QAE?AW4Status#2#F#Z)
1>Viewer.obj : error LNK2019: unresolved external symbol
_imp_niteStartPoseDetection referenced in function "public: enum nite::Status __thiscall
nite::UserTracker::startPoseDetection(short,enum nite::PoseType)"
(?startPoseDetection#UserTracker#nite##QAE?AW4Status#2#FW4PoseType#2##Z)
1>Viewer.obj : error LNK2019: unresolved external symbol
_imp_niteReadUserTrackerFrame referenced in function "public: enum nite::Status __thiscall nite::UserTracker::readFrame(class
nite::UserTrackerFrameRef *)"
(?readFrame#UserTracker#nite##QAE?AW4Status#2#PAVUserTrackerFrameRef#2##Z)
1>Viewer.obj : error LNK2019: unresolved external symbol
_imp_niteUserTrackerFrameRelease referenced in function "public: void __thiscall nite::UserTrackerFrameRef::release(void)"
(?release#UserTrackerFrameRef#nite##QAEXXZ)
1>Viewer.obj : error LNK2019: unresolved external symbol
_imp_niteConvertJointCoordinatesToDepth referenced in function "public: enum nite::Status __thiscall
nite::UserTracker::convertJointCoordinatesToDepth(float,float,float,float
*,float *)const " (?convertJointCoordinatesToDepth#UserTracker#nite##QBE?AW4Status#2#MMMPAM0#Z)
1>C:\Program
Files\PrimeSense\NiTE2\Samples\UserViewer..\Bin\UserViewer.exe :
fatal error LNK1120: 20 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I am working with OpenNI2 and Nite2 and trying to compile one of the Nite2 Sample projects.
OpenNI2 doesn't support Kinect, as long as I know, maybe you can try with old OpenNI, at least that's what I learned, after trying the same, but I don't know under windows, I'm using GNU/ubuntu.

Linker error in Visual C++ Windows Forms project

I am using SQLAPI++ to connect to Oracle from my Visual C++ application.
I can easily connect to database from VC++ only when I do it in Win32 console appliation mode.
But when I try to do the same in Windows Forms Project I get the following linker errors.
Can someone help me with this because I need the values entered in the form to be inserted into database.
My code is:
#include <SQLAPI.h>
#include "stdafx.h"
#include "Form1.h"
#include <stdio.h>
using namespace sqlapi;
[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
SAConnection con;
SACommand cmd;
try
{
con.Connect("", "scott", "tiger", SA_Oracle_Client);
cmd.setConnection(&con);
cmd.setCommandText(
"Create table test_tbl(fid integer, fvarchar20 varchar(20), fblob blob)");
cmd.Execute();
cmd.setCommandText(
"Insert into test_tbl(fid, fvarchar20) values (1, 'Some string (1)')");
cmd.Execute();
con.Commit();
}
catch(SAException &x)
{
try
{
con.Rollback();
}
catch(SAException &)
{
}
}
// Enabling Windows XP visual effects before any controls are created
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
Application::Run(gcnew Form1());
return 0;
}
And the errors I get are
sqlapi.obj : error LNK2028: unresolved token (0A000010) "public: void __clrcall SAConnection::Rollback(void)" (?Rollback#SAConnection##$$FQAMXXZ) referenced in function __catch$?main##$$HYMHP$01AP$AAVString#System###Z$0
sqlapi.obj : error LNK2028: unresolved token (0A000016) "public: void __clrcall SAConnection::Commit(void)" (?Commit#SAConnection##$$FQAMXXZ) referenced in function "int __clrcall main(cli::array<class System::String ^ >^)" (?main##$$HYMHP$01AP$AAVString#System###Z)
sqlapi.obj : error LNK2028: unresolved token (0A000018) "public: void __clrcall SACommand::setCommandText(class SAString const &,enum SACommandType_t)" (?setCommandText#SACommand##$$FQAMXABVSAString##W4SACommandType_t###Z) referenced in function "int __clrcall main(cli::array<class System::String ^ >^)" (?main##$$HYMHP$01AP$AAVString#System###Z)
sqlapi.obj : error LNK2028: unresolved token (0A000019) "public: void __clrcall SACommand::setConnection(class SAConnection *)" (?setConnection#SACommand##$$FQAMXPAVSAConnection###Z) referenced in function "int __clrcall main(cli::array<class System::String ^ >^)" (?main##$$HYMHP$01AP$AAVString#System###Z)
sqlapi.obj : error LNK2028: unresolved token (0A00001A) "public: __clrcall SAString::~SAString(void)" (??1SAString##$$FQAM#XZ) referenced in function "int __clrcall main(cli::array<class System::String ^ >^)" (?main##$$HYMHP$01AP$AAVString#System###Z)
sqlapi.obj : error LNK2028: unresolved token (0A00001B) "public: __clrcall SAString::SAString(char const *)" (??0SAString##$$FQAM#PBD#Z) referenced in function "int __clrcall main(cli::array<class System::String ^ >^)" (?main##$$HYMHP$01AP$AAVString#System###Z)
sqlapi.obj : error LNK2028: unresolved token (0A00001C) "public: void __clrcall SAConnection::Connect(class SAString const &,class SAString const &,class SAString const &,enum SAClient_t,void (__cdecl*)(class SAConnection &,enum SAConnectionHandlerType_t))" (?Connect#SAConnection##$$FQAMXABVSAString##00W4SAClient_t##P6AXAAV1#W4SAConnectionHandlerType_t###Z#Z) referenced in function "int __clrcall main(cli::array<class System::String ^ >^)" (?main##$$HYMHP$01AP$AAVString#System###Z)
sqlapi.obj : error LNK2028: unresolved token (0A00001D) "public: virtual __clrcall SACommand::~SACommand(void)" (??1SACommand##$$FUAM#XZ) referenced in function __catch$?main##$$HYMHP$01AP$AAVString#System###Z$0
sqlapi.obj : error LNK2028: unresolved token (0A00001E) "public: __clrcall SACommand::SACommand(void)" (??0SACommand##$$FQAM#XZ) referenced in function "int __clrcall main(cli::array<class System::String ^ >^)" (?main##$$HYMHP$01AP$AAVString#System###Z)
sqlapi.obj : error LNK2028: unresolved token (0A00001F) "public: virtual __clrcall SAConnection::~SAConnection(void)" (??1SAConnection##$$FUAM#XZ) referenced in function __catch$?main##$$HYMHP$01AP$AAVString#System###Z$0
sqlapi.obj : error LNK2028: unresolved token (0A000020) "public: __clrcall SAConnection::SAConnection(void)" (??0SAConnection##$$FQAM#XZ) referenced in function "int __clrcall main(cli::array<class System::String ^ >^)" (?main##$$HYMHP$01AP$AAVString#System###Z)
sqlapi.obj : error LNK2019: unresolved external symbol "public: virtual __clrcall SAConnection::~SAConnection(void)" (??1SAConnection##$$FUAM#XZ) referenced in function __catch$?main##$$HYMHP$01AP$AAVString#System###Z$0
sqlapi.obj : error LNK2019: unresolved external symbol "public: virtual __clrcall SACommand::~SACommand(void)" (??1SACommand##$$FUAM#XZ) referenced in function __catch$?main##$$HYMHP$01AP$AAVString#System###Z$0
sqlapi.obj : error LNK2019: unresolved external symbol "public: void __clrcall SAConnection::Rollback(void)" (?Rollback#SAConnection##$$FQAMXXZ) referenced in function __catch$?main##$$HYMHP$01AP$AAVString#System###Z$0
sqlapi.obj : error LNK2019: unresolved external symbol "public: void __clrcall SAConnection::Commit(void)" (?Commit#SAConnection##$$FQAMXXZ) referenced in function "int __clrcall main(cli::array<class System::String ^ >^)" (?main##$$HYMHP$01AP$AAVString#System###Z)
I dont get any errors in Win32 console mode.
I've even added the libraries in additional dependencies also.
I haven't worked with C++/CLI very much, but I think your having the same problem as answered in this question error linking to oci libraries from vc++.
I also found a comment at the bottom of this thread http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/44fc45c4-10da-4670-bc5d-2f505ee32fd1 that implies C++ windows forms projects must be in /clr:pure mode. I'm guessing that might be the difference from a console app. I also wonder if you are using a later version of Visual Studio if you could get away with using /clr mode for Window Forms?

Linker error when compiling iPhone app for Simulator using OGRE libraries

I'm trying to build an iPhone app using the OGRE framework, and I'm getting a linker error when building for the simulator that I'm not sure how to fix.
I created the Xcode project using the OGRE iPhone template. I'm using the static libraries for OGRE from the main website, Ogre_iOS_4.0_Dependencies_20100623, and trying to build for the iOS 4.1 Simulator. I'm building with Xcode 3.2.4 on Mac OS X 10.6.4.
Compilation seems to work fine, but when it gets to the link stage, I get the following errors:
Ld build/Debug-iphonesimulator/OgreTestApp.app/OgreTestApp normal i386
cd /Users/pauly/Projects/workspaces/games/OgreTestApp
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk -L/Users/pauly/Projects/workspaces/games/OgreTestApp/build/Debug-iphonesimulator -L/Users/pauly/Projects/sdk/Ogre/OgreSDK-iPhone/lib/release -L/Users/pauly/Projects/sdk/Ogre/OgreSDK-iPhone/iPhoneDependencies/lib/release -F/Users/pauly/Projects/workspaces/games/OgreTestApp/build/Debug-iphonesimulator -filelist /Users/pauly/Projects/workspaces/games/OgreTestApp/build/OgreTestApp.build/Debug-iphonesimulator/OgreTestApp.build/Objects-normal/i386/OgreTestApp.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -framework Foundation -framework UIKit -framework OpenGLES -framework QuartzCore -lboost_date_time -lboost_thread -lFreeImage -lFreeType -lOIS -lzzip -lOgreMainStatic -lRenderSystem_GLESStatic -lPlugin_BSPSceneManagerStatic -lPlugin_OctreeSceneManagerStatic -lPlugin_ParticleFXStatic -o /Users/pauly/Projects/workspaces/games/OgreTestApp/build/Debug-iphonesimulator/OgreTestApp.app/OgreTestApp
ld: warning: __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::allocate(unsigned long, void const*)has different visibility (default) in /Users/pauly/Projects/sdk/Ogre/OgreSDK-iPhone/lib/release/libOIS.a(OISInputManager.o) and (hidden) in /Users/pauly/Projects/workspaces/games/OgreTestApp/build/OgreTestApp.build/Debug-iphonesimulator/OgreTestApp.build/Objects-normal/i386/OgreFramework.o
ld: warning: std::_Rb_tree<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_Select1st<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::_M_create_node(std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > const&)has different visibility (default) in /Users/pauly/Projects/sdk/Ogre/OgreSDK-iPhone/lib/release/libOIS.a(OISInputManager.o) and (hidden) in /Users/pauly/Projects/workspaces/games/OgreTestApp/build/OgreTestApp.build/Debug-iphonesimulator/OgreTestApp.build/Objects-normal/i386/OgreFramework.o
ld: warning: std::char_traits<char>::eq(char const&, char const&)has different visibility (hidden) in /Users/pauly/Projects/sdk/Ogre/OgreSDK-iPhone/lib/release/libFreeImage.a(IPTC.o) and (default) in /Users/pauly/Projects/sdk/Ogre/OgreSDK-iPhone/lib/release/libOgreMainStatic.a(OgreString.o)
ld: warning: std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_insert_aux(__gnu_cxx::__normal_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)has different visibility (hidden) in /Users/pauly/Projects/sdk/Ogre/OgreSDK-iPhone/lib/release/libFreeImage.a(IPTC.o) and (default) in /Users/pauly/Projects/sdk/Ogre/OgreSDK-iPhone/lib/release/libOgreMainStatic.a(OgreScriptCompiler.o)
Undefined symbols:
".objc_class_name_NSAutoreleasePool", referenced from:
literal-pointer#__OBJC#__cls_refs#NSAutoreleasePool in libRenderSystem_GLESStatic.a(OgreEAGLWindow.o)
".objc_class_name_UIApplication", referenced from:
literal-pointer#__OBJC#__cls_refs#UIApplication in libOIS.a(iPhoneInputManager.o)
".objc_class_name_UIWindow", referenced from:
literal-pointer#__OBJC#__cls_refs#UIWindow in libRenderSystem_GLESStatic.a(OgreEAGLWindow.o)
".objc_class_name_UIView", referenced from:
.objc_class_name_InputDelegate in libOIS.a(iPhoneInputManager.o)
.objc_class_name_EAGLView in libRenderSystem_GLESStatic.a(OgreEAGLWindow.o)
".objc_class_name_UIAccelerometer", referenced from:
literal-pointer#__OBJC#__cls_refs#UIAccelerometer in libOIS.a(iPhoneInputManager.o)
literal-pointer#__OBJC#__cls_refs#UIAccelerometer in libOIS.a(iPhoneAccelerometer.o)
".objc_class_name_CAEAGLLayer", referenced from:
literal-pointer#__OBJC#__cls_refs#CAEAGLLayer in libRenderSystem_GLESStatic.a(OgreEAGLWindow.o)
".objc_class_name_EAGLContext", referenced from:
literal-pointer#__OBJC#__cls_refs#EAGLContext in libRenderSystem_GLESStatic.a(OgreEAGLESContext.o)
".objc_class_name_NSDictionary", referenced from:
literal-pointer#__OBJC#__cls_refs#NSDictionary in libRenderSystem_GLESStatic.a(OgreEAGLWindow.o)
".objc_class_name_NSNumber", referenced from:
literal-pointer#__OBJC#__cls_refs#NSNumber in libRenderSystem_GLESStatic.a(OgreEAGLWindow.o)
".objc_class_name_UIScreen", referenced from:
literal-pointer#__OBJC#__cls_refs#UIScreen in libOIS.a(iPhoneInputManager.o)
literal-pointer#__OBJC#__cls_refs#UIScreen in libRenderSystem_GLESStatic.a(OgreEAGLSupport.o)
literal-pointer#__OBJC#__cls_refs#UIScreen in libRenderSystem_GLESStatic.a(OgreEAGLWindow.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
How do I fix this? Thanks.
Probably you need correct precompiled Ogre dependencies for correct iOS SDK version (Masterfalcon regularly publish those dependencies on the ogre3d.org).
Similar linker errors often caused by incorrect iPhoneDependencies (build for older iPhoneSKD that you have).
Just follow the instructions as listed here:
http://www.ogre3d.org/tikiwiki/Building+Ogre+with+CMake
Secion "Configuring for iPhone".
All should build fine.