How to link luajit to c++ dll program? - lua

This is similiar topic to this one: How to link LuaJIT with a C++ program?
I've done all the same steps he did in that topic to install luajit..
I added luajit to my project like this:
Additional Library Directiories: C:\Documents\LuaJIT-2.1.0-beta3\src
Additional Include Directiories: C:\Documents\LuaJIT-2.1.0-beta3\src
And even added this #pragma comment(lib, "lua51.lib")
and for him this worked to get rid of the linker errors. Yet still im getting these errors:
1>Clua.obj : error LNK2001: unresolved external symbol _luaopen_jit
1>Clua.obj : error LNK2001: unresolved external symbol _luaopen_ffi
1>Clua.obj : error LNK2001: unresolved external symbol _luaopen_bit
1>Clua.obj : error LNK2001: unresolved external symbol _luaJIT_setmode

Related

How to ignore the errors coming from external library

i am using -Wconditional-uninitialized flag and then i am getting some errrors from the library.
external/com_google_protobuf/src/google/protobuf/arena.cc:398:12: error: variable 'arena' may be uninitialized when used here [-Werror,-Wconditional-uninitialized] return arena->AllocateAlignedWithCleanup(n, alloc_policy_.get()); ^~~~~ external/com_google_protobuf/src/google/protobuf/arena.cc:395:21: note: initialize the variable 'arena' to silence this warning SerialArena* arena; ^ = nullptr 1 error generated.
i want to filter out this error since it is coming from the library and i am using Bazel 5.0 and feature : build --features=external_include_paths but still i am seeing the above error from the library.
Could you please help me on this?

Why I have get this kind of error in Visual Studio 2022

Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol "public: __cdecl Window::Window(void)" (??0Window##QEAA#XZ) referenced in function "public: __cdecl AppWindow::AppWindow(void)" (??0AppWindow##QEAA#XZ) Game1 E:\Game\Game1\Game1\main.obj 1
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol "public: __cdecl Window::~Window(void)" (??1Window##QEAA#XZ) referenced in function "public: __cdecl AppWindow::~AppWindow(void)" (??1AppWindow##QEAA#XZ) Game1 E:\Game\Game1\Game1\main.obj 1
Severity Code Description Project File Line Suppression State
Error LNK1120 2 unresolved externals Game1 E:\Game\Game1\x64\Debug\Game1.exe 1

How to fix Unresolved external from FILE2.0?

I have some HDF5 C code that I am trying to port to C++Builder. I am getting this error at build time:
[ilink64 Error] Error: Unresolved external 'H5check_version' referenced from D:\DELPHITOOLS\PASHDF\C\WIN64\DEBUG\FILE2.O
H5check_version is included in H5public.h as a macro.
Why does C++Builder not find this?
H5check_version is included in H5public.h as a macro.
If that were true, you would not be getting a linker error, since macros are handled only during the preprocessor stage.
Somewhere in your project, the compiler is seeing a declaration of H5check_version as a function, and your file2 unit is calling it as a function, but the linker can't find the implementation of that function, hence the error.
Your project needs to contain a reference to the appropriate .lib file that either implements the actual function (static linking) or tells the linker which DLL the function is exported from (dynamic linking).
C/C++ is case sensitive, so H5check_version is different from H5Check_version.
AFAIK pascal is not case sensitive at all.
Regards

error LNK2019: unresolved external symbol _ Open CV program

I am learning open CV and for the same i was trying few programs.
I am referring to this link.
http://docs.opencv.org/modules/contrib/doc/facerec/tutorial/facerec_gender_classification.html
I am using visual studio 10 to run the same, and i think somewhere i have messed up with some configuration.
I am facing the same problem in couple of more programs (picked from same source) ,
The error which i get is as follows:-
1>main.obj : error LNK2019: unresolved external symbol "int __cdecl cv::waitKey(int)" (?waitKey#cv##YAHH#Z) referenced in function __catch$_main$0
1>main.obj : error LNK2019: unresolved external symbol "class cv::Mat __cdecl cv::subspaceReconstruct(class cv::_InputArray const &,class cv::_InputArray const &,class cv::_InputArray const &)" (?subspaceReconstruct#cv##YA?AVMat#1#ABV_InputArray#1#00#Z) referenced in function __catch$_main$0
..... (more such unresolved external symbol error)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall cv::_InputArray::empty(void)const " (?empty#_InputArray#cv##UBE_NXZ)
1>c:\users\isenses\documents\visual studio 2010\Projects\gender_classification\Debug\gender_classification.exe : fatal error LNK1120: 37 unresolved externals
1>
1>Build FAILED.
1>Time Elapsed 00:00:00.36
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
My Project Properties are as follows:-
Properties->Configuration Properties ->Debugging->command arguments->C:\Users\isenses\Documents\Visual Studio 2010\Projects\gender_classification\csv.txt
Properties->Configuration Properties ->VC++ directories->Include directories->(added C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib
&
C:\openCV_2.4\opencv\build\x86\vc10\lib)
C/C++->general->additional include directories (added include path of openCV ie:-
C:\openCV_2.4\opencv\build
Linker->General---
Enable incremental linking=no
Additional Library directories=C:\Program Files %28x86%29\Microsoft Visual Studio 10.0\VC\lib
C:\openCV_2.4\opencv\build\x86\vc10
linker->System---SubSystem= /SUBSYSTEM:CONSOLE
Linker->Input---
additional dependencies=
wsock32.lib
opencv_contrib2411d.lib
opencv_calib3d2411d.lib
opencv_ml2411d.lib
opencv_objdetect2411d.lib
Thank you.
Thanks to #miki i was able to build the file successfully.
The solution to my problem was:-
adding proper additional Dependencies in properties->linker->input.
Adding libraries path in windows environment variables.
I had not used proper additional dependencies as pointed by #miki and as quoted by him "well you also have to link opencv_coreXXX,opencv_highguiXXX, opencv_imgprocXXX etc... (with trailing "d" if in debug) in your Linker->Input--- additional dependencies"
Thanks again
I want to add an answer to this because I feel the documentation on the opencv site needs to be updated. I followed the tutorial and could not get the library to link. After many permutations I decided to look at the .lib files. My problem was quite simple. The lib files in the opencv tutorial are not complete. Specifically my lib directory includes three more lib files. I added three extra lib files to visual studio linker and the external symbol problem was solved.
I am unsure why this is the case because I was only trying to use functions contained within the core module. Anyway, hopefully this will help someone.
I am using opencv 3 and visual studio 2017.

How to fix error LNK2019 when using videoInput.lib with OpenCv2.1?

I am new in OpenCV and have some problems when using videoInput.lib,please help me.I am using winXP SP3+Cmake2.8.2+OpenCV 2.1+Visual Studio 2008.I have made every configuration and now OpenCv can be used when I am coding.I heard videoInput.lib has been included since OpenCV2.0 and I want to use it,so I tried codes below to quick test.
// Test2.cpp : Defines the entry point for the console application.
//
#include "videoInput.h"
#include "stdafx.h"
#include "cv.h"
#include "highgui.h"
#include "cxcore.h"
int main(int ,char * *)
{
int width=320;
int height=240;
IplImage *pRgb=cvCreateImage(cvSize(width,height), IPL_DEPTH_8U, 3);
videoInput video;
video.setupDevice(0, width, height);
video.showSettingsWindow(0);
while(1)
{
if(video.isFrameNew(0))
{
video.getPixels(0, (unsigned char *)pRgb->imageData, false, true);
//cvFlip(pRgb,NULL,1);
char c=cvWaitKey(1);
if(c==27) break;
cvShowImage("Video", pRgb);
}
}
}
However when I build the codes,I got following error
1>------ Build started: Project: Test2, Configuration: Debug Win32 ------
1>Compiling...
1>Test2.cpp
1>c:\opencv2.1\vc2008\include\opencv\cvcompat.h(803) : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
1>Linking...
1>Test2.obj : error LNK2019: unresolved external symbol "public: __thiscall videoInput::~videoInput(void)" (??1videoInput##QAE#XZ) referenced in function _main
1>Test2.obj : error LNK2019: unresolved external symbol "public: bool __thiscall videoInput::getPixels(int,unsigned char *,bool,bool)" (?getPixels#videoInput##QAE_NHPAE_N1#Z) referenced in function _main
1>Test2.obj : error LNK2019: unresolved external symbol "public: bool __thiscall videoInput::isFrameNew(int)" (?isFrameNew#videoInput##QAE_NH#Z) referenced in function _main
1>Test2.obj : error LNK2019: unresolved external symbol "public: void __thiscall videoInput::showSettingsWindow(int)" (?showSettingsWindow#videoInput##QAEXH#Z) referenced in function _main
1>Test2.obj : error LNK2019: unresolved external symbol "public: bool __thiscall videoInput::setupDevice(int,int,int)" (?setupDevice#videoInput##QAE_NHHH#Z) referenced in function _main
1>Test2.obj : error LNK2019: unresolved external symbol "public: __thiscall videoInput::videoInput(void)" (??0videoInput##QAE#XZ) referenced in function _main
1>C:\Documents and Settings\SKSC\My Documents\Visual Studio 2008\Projects\Test2\Debug\Test2.exe : fatal error LNK1120: 6 unresolved externals
1>Build log was saved at "file://c:\Documents and Settings\SKSC\My Documents\Visual Studio 2008\Projects\Test2\Test2\Debug\BuildLog.htm"
1>Test2 - 7 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I have been googling for a long time but still can not find the solution,I am gonna mad.Does anyone know how to fix these problems?
Thanks in advance.
I think you still need to link with videoInput.lib, OpenCV uses videoInput.lib but it doesn't mean you can use all functions of videoInput.lib from OpenCV
Yes, you have to explicitly link to videoInput.lib from the Linker.
Here you will find what you need.
Here is how you can solve it:
"Go to Project Properties -> Confuguration Properties -> Linker -> Input and add videoinput.lib along with the usual OpenCV library files." This is the solution from the site mentioned above. I tried it and it works.

Resources