Fatal errorLNK2019 and LNK1120 while use LZOpenFile? - file

I am Working on Windows Vista, and have the following code:
#include <windows.h>
// ...
INT vint = NULL;
vint = LZOpenFile(lpFileName,lpReOpenBuf,wStyle);
When I build my program, it fails with linking errors:
fatal error LNK2019: unresolved external symbol _LZOpenFileW#12 referenced in function "int_stdcall LZOpenFile(wchar_t *,struct _OFSTRUCT *,unsigned short)" (?LZOpenFile##YGHPA_WPAU_OFSTRUCT##G#Z)
fatal error LNK1120: 1 unresolved externals
Help me to resolve this problem... Thanks in Advance....

You need to link against Lz32.lib. Make sure you have this lib listed in your linking options.

thank you, Matthew Talbert
first select properties from solution explorer (right click),select linker options and then select command line options ,insert Lz32.lib on that place ......now build succeed without any fatal error......

To link against Lz32.lib in MS Visual 2008:
Project --> Properties
Then see in
--> Linker
--> Input
And in Additional Dependencies simply add Lz32.lib

Related

Including c libraries in the custome code section of Simulink

I'm trying to include Csparse from SuiteSparse in to Simulink.
I've included the header ch.h and the directory of the c-functions in the custom code section.
If I call the function cs_compress over code.ceval I get this error:
cs_compress.obj : error LNK2019: unresolved external symbol cs_spalloc referenced in function cs_compress
Test2_sfun.mexw64 : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\link.exe"' : return code '0x460'
Stop.
The function cs_spalloc I presume is called from a library since there exists no cs_spalloc.c. The function is however defined in the header file as:
cs *cs_spalloc (csi m, csi n, csi nzmax, csi values, csi triplet) ;
Am I right to presume it is called from a library?
And if so where do I find the library in a format to include in to the custom code section in Simulink?
I found the c- functions cs_spalloc online, and just copyed it. Now it works.

Assimp SimpleOpenGL example Linker errors

I'm trying to get the sample "SimpleOpenGl" from Assimp to work, but I get some linker errors i can't solve. (And yes I am very new)
I get 12 LNK2001 errors (below is two of them)
1>Sample_SimpleOpenGL.obj : error LNK2001: unresolved external symbol _aiTransformVecByMatrix4
1>Sample_SimpleOpenGL.obj : error LNK2001: unresolved external symbol _aiImportFile
When googling "aiTransformVecByMatrix4" it says that it requires cimport, but it is already included, so I am not sure why I am getting this error.
The sample project can be found here: http://assimp.svn.sourceforge.net/viewvc/assimp/trunk/samples/SimpleOpenGL/
Any help is appreciated, thanks.
If you have downloaded assimp, you must have its libraries in any place on your disk. Open your sample properties dialog, select Linker and check the path to external references.
This must give you a clue about where the sample is looking for libraries.
If you are not sure, please post your values so I can help you

CppUtest example link error

--------------------Configuration: AllTests - Win32 Debug--------------------
Linking...
AllTests.obj : error LNK2001: unresolved external symbol "int externTestGroupMockDocumentation" (?externTestGroupMockDocumentation##3HA)
AllTests.obj : error LNK2001: unresolved external symbol "int externTestGroupEventDispatcher" (?externTestGroupEventDispatcher##3HA)
Debug/AllTests.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
AllTests.exe - 3 error(s), 0 warning(s)
Why do I get these errors and how can I resolve them?
Do you have these lines in your AllTests.cpp?
IMPORT_TEST_GROUP(MockDocumentation)
IMPORT_TEST_GROUP(EventDispatcher)
If you do, you also need to have these test groups defined in you build:
TEST_GROUP(MockDocumentation)
TEST_GROUP(EventDispatcher)
James
wondering if you got over this issue,
I am facing the same issue although I have
IMPORT_TEST_GROUP(my_test_group);
in AllTests.cpp and properly defining
TEST_GROUP(my_test_group) {};
in my_test.cpp as per Mr. Grenning's advice.
Notice I have been able to get it to compile by applying either one of the following workarounds:
1- Add the cpp file containing the function definition to the UnitTest project. Or..
2- Have the function definition in the header file (typical if your function is a template)
I don't know if either/any of the suggestions is correct (so not claiming an answer yet), however, I mention my workaround here in the hope others might find it helpful.
N.B. I have CppUTest-3.6 configured with visual studio 2010 according to "D:\cpputest-3.6\docsWalkThrough_VS21010.docx"
Hasan

Unresolved symbols when linking a program using libcurl

I know this is programming questions but I'm just frustrated trying to figure out what I'm doing wrong..
I'm using visual studio 2010 and followed all the steps here: http://curl.haxx.se/libcurl/c/visual_studio.pdf
When I try to compile my solution I keep getting this error:
1>------ Build started: Project: LibCurl, Configuration: Debug Win32 ------
1>LibCurl.obj : error LNK2019: unresolved external symbol __imp__curl_easy_cleanup referenced in function _main
1>LibCurl.obj : error LNK2019: unresolved external symbol __imp__curl_easy_perform referenced in function _main
1>LibCurl.obj : error LNK2019: unresolved external symbol __imp__curl_easy_setopt referenced in function _main
1>LibCurl.obj : error LNK2019: unresolved external symbol __imp__curl_easy_init referenced in function _main
1>C:\Users\Kyle\Documents\Visual Studio 2010\libcurl\VisualStudio\LibCurl\Debug\LibCurl.exe : fatal error LNK1120: 4 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Source:
// LibCurl.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <stdio.h>
#include <curl/curl.h>
int main(void)
{
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://google.com");
res = curl_easy_perform(curl);
/* always cleanup */
curl_easy_cleanup(curl);
}
return 0;
}
I've been using static version of libcurl, and to link my program against it properly, I had to add definition:
CURL_STATICLIB
to build configuration of my project.
Besides defining CURL_STATICLIB, for me it was also necessary to link the following dependencies (including libcurl.lib or libcurld.lib):
Ws2_32.lib
Wldap32.lib
I ran into a similar issue - found that I was referencing the 64-bit location of libcurl.lib. Changed the link directory to the 32-bit location and the project compiled perfectly.
Looks like the libraries are not being successfully linked. Ensure the library directory is set to include the full path to the libcurl dll. Also make sure this library is actually added to your project.
I had the same problem. I wrote how I finally was able to make CurlLib works, here:
http://quantcorner.wordpress.com/2012/04/08/using-libcurl-with-visual-c-2010/ if you wish to have a look. Good luck!
This worked for me on VS2017 - x86 Release/Debug - MFC Static Library
Open project properties and review the following
C/C++ - Preprocessor - Preprocessor Definitions - Add CURL_STATICLIB
Linker - Input - Additional Dependencies - Add (CTRL+C)
ws2_32.lib
Normaliz.lib
Crypt32.lib
Wldap32.lib
libcurl_a.lib (libcurl_a_debug.lib for debug configuration)
C/C++ - General - Additional Include Directories - Add include
folder to header files
After many ideas and configurations, I solved the problem adding this:
#pragma comment(lib, "lib/libcurl_a.lib")
where libcurl_a.lib is the name of the curl lib file and lib is the folder which contains it.
I had the same error, the problem I had was that I built cURL according to this SO answer, which doesn't work if you wish /MT as a runtime library option.
In order to built cURL with respect to /MT and /MTD you have to also execute Set RTLIBCFG=static before actually building it with the nmake command in the very same console. Full process of building cURL this way can be found here.
Edit:
In case the URL stops working, I will also put the instructions here:
Download and extract the CUrl source code to a temp directory. http://curl.haxx.se/download.html, in this tutorial we will be using curl-7.37.0
Open the “Visual Studio Command Prompt (2010)”
Browse to the Winbuilds folder. \curl-7.37.0\winbuild.
Type Set RTLIBCFG=static into the command prompt and hit enter. This will set up the compiler to build for /MT and /MTd.
Type nmake /f MakeFile.vc mode=static DEBUG=yes to build the debug version or
Type nmake /f MakeFile.vc mode=static DEBUG=no to build the release versions.

What library should be included to use TransparentBlt?

What library should be included to use TransparentBlt?
This is VC98 (Visual Studio 6) linking to the Gdi32.lib. (Other GDI functions such as BitBlt link as expected), and the compilers compiles with out error or warning.
Even though the Gdi32.lib is included, yet the linker returns this error:
mtcombo.obj : error LNK2001: unresolved external symbol __imp__TransparentBlt#44
C:\Work\Montel\Targ2_12\guitest.exe : fatal error LNK1120: 1 unresolved externals
What am I missing?
AFAIK, you will need the Msimg32.lib
http://msdn.microsoft.com/en-us/library/ms532303(VS.85).aspx
Msimg32.lib
FYI you can search the functions on http://msdn.microsoft.com/library and at the bottom it will tell you what library you need.

Resources