node-gyp configure and node-gyp build exit without error. However, when I attempt to call the function, I get this error
dyld: lazy symbol binding failed: Symbol not found: <function_name>
Referenced from: /Users/username/src/....
Expected in: flat namespace
Can someone guide me how to debug this? What could possibly cause this kind of error?
Turn out it's an issue that the library I used is C so I have to wrap it up inside extern
sth like this
extern "C" {
#include "lib/mylib.h"
}
Related
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
--------------------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
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.
Fairly abstract question here, as I don't know quite where to start my own investigations.
I have a C package constructed with CMake that produces librpdb.so; I have a Ruby Gem set up for the same library, which produces rpdb.bundle.
When used in Ruby, I get this:
dyld: lazy symbol binding failed: Symbol not found: _RPDB_RuntimeStorageController_sharedInstance
Referenced from: /usr/local/lib/ruby/gems/1.9.1/gems/rpdb-0.1.0/lib/rpdb/rpdb.bundle
Expected in: flat namespace
When I look into the library, nm reports:
000000000000ea40 T _RPDB_RuntimeStorageController_sharedInstance
So it appears that the symbol is indeed in the library. Why, then, would binding fail?
Simply put, linking wasn't occurring at the level of the first library, although it wasn't reporting as much because the headers were found appropriately.
More details regarding why this was occurring for my circumstances, here
and also, here
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