billyquith / ponder

C++ reflection library with Lua binding, and JSON and XML serialisation.
http://billyquith.github.io/ponder/
Other
640 stars 93 forks source link

Linker error for target pondertest using MSVC 14.0 #68

Closed FlorianWolters closed 7 years ago

FlorianWolters commented 7 years ago

I try to build Ponder with Microsoft Visual C++ 14.0 (2015) using Microsoft Windows 10.0.14393:

cmake -G"CodeBlocks - Ninja" -Hponder-1.3.0 -Bbuild-ponder-1.3.0/x86/vc140/Release -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DCMAKE_INSTALL_PREFIX=../native/ponder/ponder-1.3.0-x86
cmake --build build-ponder-1.3.0/x86/vc140/Release --config Release --target install

During linking of the target pondertest the following linker error occurs (sorry for the German output):

[1/2] Linking CXX executable test\pondertest.exe
FAILED: test/pondertest.exe
cmd.exe /C "cd . && D:\win-dev-env\native\cmake\cmake-3.7.2-x86\bin\cmake.exe -E vs_link_exe --intdir=test\CMakeFiles\pondertest.dir --manifests  -- C:\PROGRA~2\MICROS~1.0\VC\bin\link.exe /nologo test\CMakeFiles\pondertest.dir\arrayproperty.cpp.obj test\CMakeFiles\pondertest.dir\class.cpp.obj test\CMakeFiles\pondertest.dir\classvisitor.cpp.obj test\CMakeFiles\pondertest.dir\constructor.cpp.obj test\CMakeFiles\pondertest.dir\dictionary.cpp.obj test\CMakeFiles\pondertest.dir\enum.cpp.obj test\CMakeFiles\pondertest.dir\enumclass.cpp.obj test\CMakeFiles\pondertest.dir\enumclassobject.cpp.obj test\CMakeFiles\pondertest.dir\enumclassproperty.cpp.obj test\CMakeFiles\pondertest.dir\enumobject.cpp.obj test\CMakeFiles\pondertest.dir\enumproperty.cpp.obj test\CMakeFiles\pondertest.dir\example_mainpage.cpp.obj test\CMakeFiles\pondertest.dir\function.cpp.obj test\CMakeFiles\pondertest.dir\functionaccess.cpp.obj test\CMakeFiles\pondertest.dir\inheritance.cpp.obj test\CMakeFiles\pondertest.dir\main.cpp.obj test\CMakeFiles\pondertest.dir\mapper.cpp.obj test\CMakeFiles\pondertest.dir\property.cpp.obj test\CMakeFiles\pondertest.dir\propertyaccess.cpp.obj test\CMakeFiles\pondertest.dir\string_view.cpp.obj test\CMakeFiles\pondertest.dir\tagholder.cpp.obj test\CMakeFiles\pondertest.dir\traits.cpp.obj test\CMakeFiles\pondertest.dir\userobject.cpp.obj test\CMakeFiles\pondertest.dir\userproperty.cpp.obj test\CMakeFiles\pondertest.dir\value.cpp.obj  /out:test\pondertest.exe /implib:test\pondertest.lib /pdb:test\pondertest.pdb /version:0.0  /machine:X86 /INCREMENTAL:NO  /subsystem:console  ponder.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
arrayproperty.cpp.obj : error LNK2019: Verweis auf nicht aufgel÷stes externes Symbol ""char const * __cdecl ponder::detail::typeAsString(enum ponder::ValueType)" (?typeAsString@detail@ponder@@YAPBDW4ValueType@2@@Z)" in Funktion ""public: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl ponder_ext::ValueMapper<enum ponder::ValueType,void>::to(enum ponder::ValueType)" (?to@?$ValueMapper@W4ValueType@ponder@@X@ponder_ext@@SA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@W4ValueType@ponder@@@Z)".
function.cpp.obj : error LNK2001: Nicht aufgel÷stes externes Symbol ""char const * __cdecl ponder::detail::typeAsString(enum ponder::ValueType)" (?typeAsString@detail@ponder@@YAPBDW4ValueType@2@@Z)".
property.cpp.obj : error LNK2001: Nicht aufgel÷stes externes Symbol ""char const * __cdecl ponder::detail::typeAsString(enum ponder::ValueType)" (?typeAsString@detail@ponder@@YAPBDW4ValueType@2@@Z)".
traits.cpp.obj : error LNK2001: Nicht aufgel÷stes externes Symbol ""char const * __cdecl ponder::detail::typeAsString(enum ponder::ValueType)" (?typeAsString@detail@ponder@@YAPBDW4ValueType@2@@Z)".
test\pondertest.exe : fatal error LNK1120: 1 nicht aufgel÷ste Externe
LINK failed. with 1120
ninja: build stopped: subcommand failed.

My build environment is not to blame, since I can successful build other C++ libraries using the same environment/toolchain.

billyquith commented 7 years ago

Hi there.

Do you have the latest version of the code? I think typeAsString is from an older version. It no longer exists.

FlorianWolters commented 7 years ago

I've used https://github.com/billyquith/ponder/archive/1.3.0.zip. I will retry with HEAD later.

billyquith commented 7 years ago

I think this happened because it was an old version of the code. Latest should avoid/fix this.

FlorianWolters commented 7 years ago

The current master "fixes" the issue, but introduces another problem:

[26/55] Building CXX object CMakeFiles\ponder.dir\src\uses\report.cpp.obj
D:\win-dev-env\_builds\ponder-master\src\uses\report.cpp(224): warning C4018: "<": Konflikt zwischen "signed" und "unsigned"
[27/55] Linking CXX shared library ponder.dll
   Bibliothek "ponder.lib" und Objekt "ponder.exp" werden erstellt.
[35/55] Building CXX object test\ponder\CMakeFiles\pondertest.dir\constructor.cpp.obj
D:\win-dev-env\_builds\ponder-master\test\ponder\constructor.cpp(186): warning C4309: "Initialisierung": Verkürzung eines konstanten Wertes
D:\win-dev-env\_builds\ponder-master\test\ponder\constructor.cpp(521): warning C4309: "Initialisierung": Verkürzung eines konstanten Wertes
[52/55] Linking CXX executable test\examples\egtest.exe
FAILED: test/examples/egtest.exe
cmd.exe /C "cd . && D:\win-dev-env\native\cmake\cmake-3.7.2-x86\bin\cmake.exe -E vs_link_exe --intdir=test\examples\CMakeFiles\egtest.dir --manifests  -- C:\PROGRA~2\MICROS~1.0\VC\bin\link.exe /nologo test\examples\CMakeFiles\egtest.dir\main.cpp.obj test\examples\CMakeFiles\egtest.dir\simple.cpp.obj  /out:test\examples\egtest.exe /implib:test\examples\egtest.lib /pdb:test\examples\egtest.pdb /version:0.0  /machine:X86 /INCREMENTAL:NO  /subsystem:console  ponder.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
simple.cpp.obj : error LNK2019: Verweis auf nicht aufgel÷stes externes Symbol ""void __cdecl ponder::detail::fmt::print(class ponder::detail::fmt::BasicCStringRef<char>,class ponder::detail::fmt::ArgList)" (?print@fmt@detail@ponder@@YAXV?$BasicCStringRef@D@123@VArgList@123@@Z)" in Funktion ""void __cdecl ponder::detail::fmt::print<>(class ponder::detail::fmt::BasicCStringRef<char>)" (??$print@$$V@fmt@detail@ponder@@YAXV?$BasicCStringRef@D@012@@Z)".
simple.cpp.obj : error LNK2019: Verweis auf nicht aufgel÷stes externes Symbol ""void __cdecl ponder::uses::reportAll(void)" (?reportAll@uses@ponder@@YAXXZ)" in Funktion ""void __cdecl ____C_A_T_C_H____T_E_S_T____111(void)" (?____C_A_T_C_H____T_E_S_T____111@@YAXXZ)".
test\examples\egtest.exe : fatal error LNK1120: 2 nicht aufgel÷ste Externe
LINK failed. with 1120
[53/55] Building CXX object test\ponder\CMakeFiles\pondertest.dir\value.cpp.obj
ninja: build stopped: subcommand failed.

But than can be worked around by building with the BUILD_TEST=OFF option as follows:

cmake -GNinja -Hponder-master -Bbuild-ponder-master/x86/vc140/Release -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DCMAKE_INSTALL_PREFIX=../native/ponder/ponder-x86 -DBUILD_TEST=OFF
cmake --build build-ponder-master/x86/vc140/Release --config Release --target install