error LNK1120: 6 unresolved externals - unresolved-external

Helo, this is my first post here.
I have searched the forum first and few of them were a bit related to my linkage error but still I couldn't remove the error that I am getting. Following are the errors and 6 more errors exactly like the Error 2.
Error 2 error LNK2019: unresolved external symbol
_imp_hismodgametrak_resetLevel referenced in function "private: void __thiscall DemoApp::startClient(char const *,int)" (?startClient#DemoApp##AAEXPBDH#Z) D:\New SVN FOR
CAVE\Tools\GameEngine\Samples\TutorialApp\DemoApp.obj DemoApp
Error 8 error LNK1120: 6 unresolved externals D:\New SVN FOR
CAVE\Tools\GameEngine\bin\DemoAppd.exe DemoApp
Does some one has any idea?

I found the solution to my problem in this forum.
Anyone can follow and use it for his/her purpose too for solving thier problem. It was very helpful.

I had to add:
#pragma comment(lib, "ws2_32.lib")
#pragma comment(lib, "irprops.lib")
Using the Winsock Stacks. So my Includes look like this:
#include <stdio.h>
#include <initguid.h>
// Link to ws2_32.lib
#include <winsock2.h>
#include <ws2bth.h>
#pragma comment(lib, "ws2_32.lib")
#pragma comment(lib, "irprops.lib")
An excellent answer here: Fatal error LNK1120: 4 unresolved externals helped me out!!! Thanks Victor!!!

Related

Problem with winsocks after project migration to VS2022

Headers order below
#include <winsock2.h>
#include <ws2tcpip.h>
#include <windows.h>
All code was written and debugged in VS2019, and compiles there fine. But after migration appears classic problem of misordering winsockets headers.
As that
error C2011: 'sockaddr' : 'struct' type redefinition
Anybody any suggestions, what is the cause ?

pybind11 compiling error in common.h(635): error C2988: unrecognizable template declaration/definition

I am trying to use pybind11 in UnrealeEngine, as a plugin. While I can compile fine a standalone project on Win10 with VS2019 and Python 3.9.0, when compiling inside a UE4 Project I got this error(s):
D:\work_in_progress\UE4\PB11_TEST\Plugins\myPlugin\Source\PyBind11\include\pybind11\detail/common.h(635): error C2988: unrecognizable template declaration/definition
D:\work_in_progress\UE4\PB11_TEST\Plugins\myPlugin\Source\PyBind11\include\pybind11\detail/common.h(637): note: see reference to class template instantiation 'pybind11::detail::is_template_base_of_impl<Base>' being compiled
D:\work_in_progress\UE4\PB11_TEST\Plugins\myPlugin\Source\PyBind11\include\pybind11\detail/common.h(635): error C2059: syntax error: '<end Parse>'
...and more...
it is clearly something related to UE4, I already have spent one day trying to figure out where to search, with no result. Could someone maybe point me in the right direction? This happens even if I only #include "pybind11/pybind11.h"`.
Using Visual Studio 2019 14.28.29334 toolchain and Windows 10.0.17763.0 SDK
Thanks!
Rob
With the help of pybind11 crew, I have a found a solution. The issue is caused by a UE4 macro: check. To overcome macro pollution in my pybind11 plugin, I added the following code to my header file:
THIRD_PARTY_INCLUDES_START
#pragma push_macro("check")
#undef check
#pragma warning (push)
#pragma warning (disable : 4191)
#pragma warning (disable : 4686)
#include "pybind11/pybind11.h"
#pragma warning (pop)
#pragma pop_macro("check")
THIRD_PARTY_INCLUDES_END
As you can see, also a couple of warnings have been silenced, because UE4 enables them (by default in VS2019, they are disabled).
Hope this can be of some help if someone got trapped with the same problem.

Allegro Installation

I've been trying to install allegro 5 into MSVS 2015 for 3 hours now, and have seen many tutorials, none of which helped me. I am using the code on the tutorial wiki to just make a screen.
#include "windows.h"
#include <stdio.h>
#include <allegro5/allegro.h>
int main(int argc, char **argv)
{
ALLEGRO_DISPLAY *display = NULL;
if (!al_init()) {
fprintf(stderr, "failed to initialize allegro!\n");
return -1;
}
display = al_create_display(640, 480);
if (!display) {
fprintf(stderr, "failed to create display!\n");
return -1;
}
al_clear_to_color(al_map_rgb(0, 0, 0));
al_flip_display();
al_rest(10.0);
al_destroy_display(display);
return 0;
}
This is the error I get.
1>------ Build started: Project: Project7, Configuration: Debug Win32 ------
1> Source.cpp
1>Source.obj : error LNK2019: unresolved external symbol _al_rest referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol _al_map_rgb referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol _al_create_display referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol _al_destroy_display referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol _al_flip_display referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol _al_clear_to_color referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol _al_install_system referenced in function _main
1>c:\users\jacob\documents\visual studio 2015\Projects\Project7\Debug\Project7.exe : fatal error LNK1120: 7 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Anything helps, thanks.
Unresolved external symbol implies a compile-time linker error. When you downloaded Allegro, it will have come with a collection of resources:
includes (.h/.hpp): These are header files which define what functions exist within the library, but will not actually contain the function code themselves.
libraries (.lib): These files contain pre-compiled code and need to be linked to your project.
dlls (.dll): DLLs aren't always used when you have other library resources, however they support runtime linkage and need to be distributed with your application in order for it to run correctly.
Linker Errors
You are most likely missing a link to your libraries. In Visual studio, you can add references to libraries by right clicking on your project in the solution explorer and navigating to the linker section.
You will need to add the path to the "lib" folder in your allegro download. This can be done by adding the filepath to the additional library dependencies field.
Hope this helps!

Why Symbol 'CV_8UC3' could not be resolved in Eclipse OS X?

I'm getting Symbol 'CV_8UC3' could not be resolved error and can't build the project.
cv::Mat ImgBuf(yRes,xRes,CV_8UC3,(unsigned char*) g_Img);
This includes have been included without any error.
#include <cv.h>
#include <highgui.h>

unresolved external symbol - Error using Matlab API

I'm trying to read a .mat-file in C++ with MSVS 2008 but when building a simple program I get the following error:
1>ex3.obj : error LNK2019: unresolved external symbol _matClose referenced in function _main
1>ex3.obj : error LNK2019: unresolved external symbol _matOpen referenced in function _main
I've researched Google as well and it seems that the compiler can't link to the libraries needed for using this functions (matOpen and matClose). I never used an external library before but I tried everything I found in Google to add the Matlab libraries. I did the following:
TOOLS --> Options --> Projects and Solutions --> VC++ Directories --> Show directories for: include files --> then I added the path of the matlab include directory --> C:\Program Files\MATLAB\extern\include
I did the same with the library files: C:\Program Files\MATLAB\extern\lib\win64\microsoft
I also did that for the project:
Right click on the project --> Properties --> Configuration Properties --> C/C++ --> General --> Additional Include Directories --> and added "C:\Program Files\MATLAB\extern\include\win64"
Then I did the same at Linker --> General --> Additional Library Directories --> and added "C:\Program Files\MATLAB\extern\lib\win64\microsoft"
So I really don't know where the problem is. Here is the source code I'm trying to build:
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <mat.h>
int main(int argc, char *argv[])
{
const char *file = "mozart_part1.mat";
MATFile *pmat;
pmat = matOpen(file, "r");
if(pmat == NULL)
{
std::cout << "Error: could not open MAT-file!";
return(1);
}
matClose(pmat);
}
Can you see or guess any mistakes I made
Take a look here.
Go through the steps.
What I think you've missed is step 7:
7.Locate the .lib files for the compiler you are using under matlabroot\extern\lib\win32\microsoft or matlabroot\extern\lib\win64\microsoft. Under Linker Input properties, add libmx.lib, libmex.lib, and libmat.lib as additional dependencies.
Edit:
Both Matlab and Visual C++ should be either 32bit or 64bit. There are two options:
Find these 3 lib files from another Matlab which is 32bit. Direct your linker there instead.
Make your Visual C++ 64bit. See here how it's done.
Solution:
What eventually worked was option 2, using this link with instructions.
I solved the Problem!
#Michael Litvin: you were right! I didn't know that you have to switch MSVS 2008 to x64 platform.
As the Matlab libraries are provided as x64 binaries you have to switch your MSVS compiler to x64 as well. I followed these steps to do that: http://software.intel.com/en-us/articles/configuring-microsoft-visual-studio-for-64-bit-applications/
Thanks for you help!