unresolved external symbol _SDL_main referenced in function _main_getcmdline [duplicate] - c++

This question already has answers here:
What is an undefined reference/unresolved external symbol error and how do I fix it?
(39 answers)
Closed 1 year ago.
This is probably me being stupid but what am I doing wrong here? I'm not sure if I need the code but I'm doing this in Visual Studio 2019.

Are you sure you specified both assembly versions correctly in the linker? This means both for release and for debug.
Considering that you are using VisualStudio2019, I strongly advise you to use vcpkg - this is a package management made by Microsoft that simplifies the installation of libraries and other features in 1 line =)
Using it, you do not even need to enter the linker, and the official vcpkg website will help you configure it correctly.

Did you make sure that your project is linked with SDL2.lib and SDL2main.lib?

Related

Suddenly getting LNK2001 errors [duplicate]

This question already has answers here:
What is an undefined reference/unresolved external symbol error and how do I fix it?
(39 answers)
Closed 2 years ago.
Been working on this project in Visual Studio 2017 for a couple weeks, and suddenly since my last build I started getting hundreds of LNK2001 errors. The supposed unresolved symbols seem to be standard CRT and C++ stuff, for example memmove, _imp_CrtDbgReport, strlen, etc. I was doing some stuff in the config of my project so I'm betting I hovered over an option and accidentally scrolled or something, but I can't seem to see any obvious issue.
The project is still being generated with the MDd CRT, I'm not ignoring default libs. I have, however, started using a new 3rd party library, but again the supposed LNK2001 errors are for things like strlen and memcpy.
To be clear, the issue I'm facing is that the standard C and C++ library functions like strlen, memmove, etc. that I have been using the entire time (not explicitly) are suddenly showing up as unresolved external symbols.
I found the issue. I was passing in a command line argument to set the entry point to be wWinMain rather than just setting the subsystem type of the application to Windows.

Error LNK2019 when trying to use MRPT libraries as external dependency in VS2019 solution

I am implementing a SLAM-algorithm in Visual Studio 2019 where I want to use the ICP algorithm from the MRPT library for scan-matching.
I installed the MRPT library as 32-bit from source code using CMake. Problem is the error I'm receiving when building the solution (shown below). I assume it is because I have not added Additional Library Directories or Additional Dependencies for the Linker, because I can't find the .lib/.dll files anywhere. I tried installing the 64-bit precompiled binaries for Windows, where I found the .lib-files inside a lib-folder which does not appear when compiling manually with the source code - but can't use the same lib's because I need 32-bit (I tried linking to them, but the same error occurred in addition a bunch of warnings that library is 64-bit and target is 32-bit).
The code is pretty much exactly the same as the first example here, with (I believe) all necessary headers included.
The error produced (I also receive many more of the same error for every class I attempt to use from the library):
particle.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall mrpt::poses::CPose2D::CPose2D(double,double,double)" (__imp_??0CPose2D#poses#mrpt##QAE#NNN#Z) referenced in function (function)
The quick question is: Shouldn't the .lib/.dll files be produced when compiling from source code as well? Or is there something embedded in the library so I don't need them, in which case there must be something else wrong?
The more complicated question is: If the missing .dll/.lib-files is not the problem, what could it be?
Sorry if I am missing any relevant information, this is my first post. Just let me know and I will provide.
Any help is greatly appreciated!

Linking errors only when using Qt creator [duplicate]

This question already has answers here:
What is an undefined reference/unresolved external symbol error and how do I fix it?
(39 answers)
Closed 4 years ago.
I have linking problems when I execute some code that links to different shared libraries. The fact is that I haven't them if I use the console, but only if I execute it within the Qt creator IDE.
Do you guys know if there a kind of console where I can use nm readelf and stuff like that with the QT build / runtime environment?
Alternatively, how would you debug such problem?
Specifically, the error I get is something like:
symbol lookup error: blabla undefined symbol: blabla
[EDIT] Suggested question is different in respect to what I'm asking. I'm specifically speaking about the qt creator environment, not linking errors in general. Specifically, it's about how to debug linking errors in qt creator when using the console everything seems ok.
1) Can you explain a bit more in detail what you need?
2) Can you publish your .pro file generated by Qt Creator?

unresolved external symbol (LNK 2001) error with pcap functions [duplicate]

This question already has answers here:
What is an undefined reference/unresolved external symbol error and how do I fix it?
(39 answers)
Closed 7 years ago.
I know how to fix typical LNK2019 errors in MSVS (2013) but I'm having some extra trouble when trying to use winpcap..
I installed winpcap from this site (a couple times, actually), which supposedly installed the necessary .dlls I need, and I also installed the developer kit and pointed the linker to it as so: (1), (2).
I placed WIN32 in my preprocessor directives (or rather, defines), which took away compilation errors. However, when I run the test code at the bottom of this post, I get these errors.
Test code here: http://pastie.org/10730081
Looking at your screenshot, you have added the paths to both the 64-bit and 32-bit library files. If the developers of the library were not careful to use different names for their 64-bit and 32-bit editions, then the linker won't be able to find the right functions.
It is searching first in the 64-bit folder (because that's the one you have listed first), but you are compiling the application targeting a 32-bit architecture (the "Win32" project configuration is active).
The fix is simple: make sure that you have matched up the "Library Directories" with your project configuration:
Win32 → C:\code\C++\libs\WpdPack\Lib\
x64 → C:\code\C++\libs\WpdPack\Lib\x64\

Display frame from VNC/RFB into an OpenGL application [duplicate]

This question already has answers here:
What is an undefined reference/unresolved external symbol error and how do I fix it?
(39 answers)
Closed 8 years ago.
I would like to be able to display remote client in a simple OpenGL application. "Simple" means only display the client such as a texture.
I started to look the VNC protocol but due to their popularity I only have few documentation related to VNCViewer. About RFB the only documentation is: http://www.realvnc.com/docs/rfbproto.pdf which is cool to understand the protocol but not enough to use it in a C++ OpenGL application. Then I found: http://libvnc.github.io/
I tried to compile the example (downloaded from github). So I added into my qtproject all rfb headers files run cmake on some of them. Then I built it but got the error:
undefined reference to `rfbMakeXCursor' and many others related to rfbXxxxx
rfb.h contains declarations to those "undefined" errors.
I don't understand what did I do wrong. Has anybody already made it work?
I'm working on Windows 8.1 64bit using C++ qtCreator and MinGW.
Headers are just ""able of contents" for the compiler to know, which functions can be called. You need to actually link to the library. The odds are, that since you've got it from GitHub you must first build the library. The built library you then add to some "extras/lib" directory in your project, configure that directory as additional library directory and add the library to the linker flags.