LNK2019 unresolved symbol compiling LuaJava with Visual Studio 2012 - visual-studio-2012

I am working with visual studio 2012 to compile LuaJava. The problem I am having is when I call the linker. The line that calls the linker in the makefile is:
link /dll /LIBPATH:"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\x64"
/LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\lib\amd64"
/out:luajava-1.1.dll src\c\luajava.obj
"C:\Program Files (x86)\Lua\5.1\lib\lua5.1.lib" /VERBOSE
This seems to almost be linking everything successfully, until it gets to the Lua library.
The linker outputs the following when I try to make the project:
...//linking of other libraries
Finished searching libraries
Unused libraries:
C:\Program Files (x86)\Lua\5.1\lib\lua5.1.lib
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\lib\amd64\OLDNAMES.lib
luajava.obj : error LNK2019: unresolved external symbol lua_close referenced in function Java_org_keplerproject_luajava_LuaState__1close
luajava.obj : error LNK2019: unresolved external symbol lua_newthread referenced in function Java_org_keplerproject_luajava_LuaState__1newthread
luajava.obj : error LNK2019: unresolved external symbol lua_gettop referenced in function Java_org_keplerproject_luajava_LuaState__1getTop
...//lots of these errors
luajava-1.1.dll : fatal error LNK1120: 88 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\x86_amd64\link.EXE"' : return code '0x460'
Stop.
I'm confused as to why it says that the Lua library is unused, and then complains when it can't find the Lua library functions.

You can not link a 32 bit library to your 64 bit application. After some searces I do not believe LuaJava has a x64 download so to use this you must change your application to 32 bit.
Edit:
A second method would be to recomile LuaJava as a 64 bit dll. Here is a very recent post about that: LuaJava compile error "Unresolved external symbol"

Related

How to link Bcrypt.lib to VC++ DLL project

Trying to compile a VC++ DLL I get some error messages related to Visual Studio cannot resolve external symbols, errors LNK2001, LNK1120.
In my case the symbol it cannot be resolved is: __imp__BCryptGenRandom#16
and the error message is:
error LNK2001: unresolved external symbol __imp__BCryptGenRandom#16
I have googled and found that it is said to link BCrypt.lib so I have linked it at "properties->linker->input->additional dependency"
Also at ""properties->linker->all options->additional library directoris" I have added below one where BCrypt.lib is for x86:
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\x86
And finally at "properties->linker->General->Use library dependencies inputs" I have set "Yes".
But none of these methods work.

MSVC2017 compiler error, Chromium build fails

So I am on:
Windows 10
MS Visual Studio 2017 (2017 build tools)
trying to build:
qt5.10.1 with QtWebEngine
using jom.exe -j4
and during the QtWebEngine build process, this happened:
[51/12427] CC obj/third_party/webrtc/common_audio/common_audio_c/sqrt_of_one_minus_x_squared.obj
[52/12427] CC obj/third_party/webrtc/common_audio/common_audio_c/complex_fft.obj
[53/12427] CXX obj/third_party/webrtc/call/call/call.obj
FAILED: obj/third_party/webrtc/call/call/call.obj
ninja -t msvc -e environment.x64 -- "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\HostX64\x64/cl.exe" /nologo /showIncludes #obj/third_party/webrtc/call/call/call.obj.rsp /c ../../3rdparty/chromium/third_party/webrtc/call/call.cc /Foobj/third_party/webrtc/call/call/call.obj /Fd"obj/third_party/webrtc/call/call_cc.pdb"
C:\Qt\qt-everywhere-src-5.10.1\qtwebengine\src\3rdparty\chromium\third_party\webrtc/modules/video_coding/sequence_number_util.h(101): fatal error C1001: An internal error has occurred in the compiler.
(compiler file 'f:\dd\vctools\compiler\cxxfe\sl\p1\c\outdname.c', line 5310)
To work around this problem, try simplifying or changing the program near the locations listed above.
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\include\xutility(301): note: see reference to class template instantiation 'webrtc::DescendingSeqNumComp<uint16_t,0>' being compiled
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\include\xutility(301): note: see reference to variable template 'const bool is_empty_v<webrtc::DescendingSeqNumComp<unsigned short,0> >' being compiled
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\include\xtree(1078): note: see reference to class template instantiation 'std::_Tree_comp_alloc<_Traits>' being compiled
with
[
_Traits=std::_Tmap_traits<uint16_t,webrtc::NackModule::NackInfo,webrtc::DescendingSeqNumComp<uint16_t,0>,std::allocator<std::pair<const uint16_t,webrtc::NackModule::NackInfo>>,false>
]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\include\map(82): note: see reference to class template instantiation 'std::_Tree<std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,false>>' being compiled
with
[
_Kty=uint16_t,
_Ty=webrtc::NackModule::NackInfo,
_Pr=webrtc::DescendingSeqNumComp<uint16_t,0>,
_Alloc=std::allocator<std::pair<const uint16_t,webrtc::NackModule::NackInfo>>
]
C:\Qt\qt-everywhere-src-5.10.1\qtwebengine\src\3rdparty\chromium\third_party\webrtc/modules/video_coding/nack_module.h(88): note: see reference to class template instantiation 'std::map<uint16_t,webrtc::NackModule::NackInfo,webrtc::DescendingSeqNumComp<uint16_t,0>,std::allocator<std::pair<const _Kty,_Ty>>>' being compiled
with
[
_Kty=uint16_t,
_Ty=webrtc::NackModule::NackInfo
]
[54/12427] CC obj/third_party/webrtc/common_audio/common_audio_c/refl_coef_to_lpc.obj
[55/12427] CC obj/third_party/webrtc/common_audio/common_audio_c/vector_scaling_operations.obj
[56/12427] CC obj/third_party/webrtc/common_audio/common_audio_c/spl_sqrt_floor.obj
[57/12427] CC obj/third_party/webrtc/common_audio/common_audio_c/resample_by_2.obj
[58/12427] CC obj/third_party/webrtc/common_audio/common_audio_c/webrtc_vad.obj
[59/12427] CC obj/third_party/webrtc/common_audio/common_audio_c/spl_init.obj
[60/12427] CXX obj/third_party/webrtc/common_audio/common_audio/sparse_fir_filter.obj
[61/12427] CXX obj/third_party/webrtc/common_audio/common_audio/real_fourier_ooura.obj
[62/12427] CXX obj/third_party/webrtc/common_audio/common_audio_cc/dot_product_with_scale.obj
ninja: build stopped: subcommand failed.
jom: C:\Qt\qt-everywhere-src-5.10.1\qtwebengine\src\core\Makefile.gn_run.Debug [run_ninja] Error 1
jom: C:\Qt\qt-everywhere-src-5.10.1\qtwebengine\src\core\Makefile.gn_run [debug-all] Error 2
jom: C:\Qt\qt-everywhere-src-5.10.1\qtwebengine\src\core\Makefile [sub-gn_run-pro-make_first] Error 2
jom: C:\Qt\qt-everywhere-src-5.10.1\qtwebengine\src\Makefile [sub-core-make_first] Error 2
jom: C:\Qt\qt-everywhere-src-5.10.1\qtwebengine\Makefile [sub-src-make_first] Error 2
jom: C:\Qt\qt-everywhere-src-5.10.1\Makefile [module-qtwebengine-make_first] Error 2
C:\Qt\qt-everywhere-src-5.10.1>
I found this forum with a slightly active/recent question asking about this same issue here:
Internal compiler error in outdname.c in VS15.7p3 when building Firefox webrtc code
Is there anything I can do from this point to fix this?
Downgrading my version of VS to 2015 allowed me to bypass this compiler error and compile QT successfully.

How to make JsonCPP works in MFC c++ project

I was able to create a test WinApp using JsonCPP (https://github.com/open-source-parsers/jsoncpp) to parse a json file.
However, when I implemented similar in an MFC C++ project with C/C++ -> Precompiled Headers option set to Use Precompiled Header(/Yu) in VS2008, it fails with this error:
c:\users\user1\documents\visual studio 2008\projects\jsonutility\jsonutility\jsonTest.cpp(371) : fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?
If I add '#include "stdafx.h"' to my JsonTest.cpp, I will get this error:
JsonTest.obj : error LNK2019: unresolved external symbol "public: class Json::Value & __thiscall Json::Value::operator[](char const *)" (??AValue#Json##QAEAAV01#PBD#Z) referenced in function "public: void __thiscall JsonTest::readConfig(char const *)" (?readConfig#JsonTest##QAEXPBD#Z)
I have tried for almost 2 days now but no success.
I had added the following in my Additional Include Directories:
C:\Users\User1\Documents\Visual Studio 2008\Projects\JsonUtility\ReadingJson\dist
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include
C:\usr\jsoncpp-master\include
I seems like you didn't include the JSONCPPs *.cpp file into your project (they have to be compiled and linked). If the library gets compiled to a static library, you have to tell the linker what to link.

Error LNK2019 Directx10 VC++2010

I am trying to learn about DirectX 2010, after setting up the Libraries
how i installed the Libraries:-
VC++ 2010-View-other windows-Property manager
i opened the Microsoft.Cpp.Win32.user
VC++ Directories :-
Include Directories: C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include
Library Directories: C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x64
here is the Error list i get:-
Error 1 error LNK2019: unresolved external symbol _D3DX10CreateEffectFromFileW#48 referenced in function "long __cdecl InitDevice(void)" (?InitDevice##YAJXZ) c:\Users\ahmed_saad\documents\visual studio 2010\Projects\CodeName_Yarab\CodeName_Yarab\Main.obj CodeName_Yarab
Error 2 error LNK2019: unresolved external symbol _D3D10CreateDeviceAndSwapChain#32 referenced in function "long __cdecl InitDevice(void)" (?InitDevice##YAJXZ) c:\Users\ahmed_saad\documents\visual studio 2010\Projects\CodeName_Yarab\CodeName_Yarab\Main.obj CodeName_Yarab
Error 3 error LNK1120: 2 unresolved externals c:\users\ahmed_saad\documents\visual studio 2010\Projects\CodeName_Yarab\Debug\CodeName_Yarab.exe 1 1 CodeName_Yarab
i am using Windows 8 pro x64
It might be that you'll need to link to a .lib-file, because DX ist not among the usual libraries.
Look for a .lib file and add it to your Linker properties.

Linker Error: Precombiled Library VC++ 6.0 with VC++ 8.0 Program

I am trying to recompile some code I have for a new system. It involves a precompiled static library that I do not have the source code for (just the header), and this library was built with VC++ 6.0 or older with the older runtime libraries. On my old system, which had VC++ 6.0, my program was built and ran fine, but I have recently upgraded things and I no longer have access to VC++ 6.0, only Express 2008 (9.0 w/ SP).
When I build the solution, it compiles but has the following linker error:
1>libcpmtd.lib(xlock.obj) : error LNK2005: "public: __thiscall
std::_Lockit::~_Lockit(void)" (??1_Lockit#std##QAE#XZ) already defined
in NOREC.lib(track.obj) 1>LIBCMT.lib(stdexcpt.obj) : error LNK2005:
"public: __thiscall std::bad_cast::bad_cast(char const *)"
(??0bad_cast#std##QAE#PBD#Z) already defined in NOREC.lib(track.obj)
1>LIBCMT.lib(stdexcpt.obj) : error LNK2005: "public: __thiscall
std::bad_cast::bad_cast(class std::bad_cast const &)"
(??0bad_cast#std##QAE#ABV01##Z) already defined in
NOREC.lib(track.obj) 1>LIBCMT.lib(stdexcpt.obj) : error LNK2005:
"public: virtual __thiscall std::bad_cast::~bad_cast(void)"
(??1bad_cast#std##UAE#XZ) already defined in NOREC.lib(track.obj)
1>LINK : fatal error LNK1104: cannot open file 'libcp.lib'
Any ideas how to overcome this issue would be very welcome.
From the last link error, libcp.lib cannot be found. This library has been removed as of VS 2005. Use /MT for the multithreaded version.
http://msdn.microsoft.com/en-us/library/abx4dbyh%28v=vs.80%29.aspx
The multithreaded version is libcpmt.lib which you will get automatically with the /MT flag. I see in the first error you are using libcpmtd.lib which is the debug version of the same. I'm not sure how you are getting that if you are not using /MTd. (or if you are, how libcp.lib is referenced since you should be using one or the other, not both)
The linker is telling you that some symbols are defined more than once. The brute force to convice the linker to produce your target image is to use the /FORCE:MULTIPLE as explained here. I used to use this switch a few times.
LINK : fatal error LNK1104: cannot open file 'libcp.lib'
This is a bug in the linker. Just create an empty file named libcp.lib in the LIBPATH.
libcp.lib you can find in installed MS Visual Studio 6.0 in
c:\Program Files\Microsoft Visual Studio\VC98\Lib\
directory.
Just copy it to your MSVS 2005/2008/2010 lib directory
(i.e. c:\Program Files\Microsoft Visual Studio 8\VC\lib\)
And everything will compiled just fine.

Resources