Build C++ XPCOM dependency error - c++

I am building my C++ XPCOM for extension with Gecko sdk 24, but I got below error:
Error 15 error LNK2001: unresolved external symbol __imp__NS_CStringContainerInit2 xpcomglue_s_nomozalloc.lib
Error 16 error LNK2001: unresolved external symbol __imp__NS_CStringContainerFinish xpcomglue_s_nomozalloc.lib
Error 17 error LNK2001: unresolved external symbol __imp__NS_CStringContainerInit xpcomglue_s_nomozalloc.lib
Error 18 error LNK2001: unresolved external symbol __imp__NS_GetServiceManager xpcomglue_s_nomozalloc.lib
Error 19 error LNK2001: unresolved external symbol __imp__NS_GetComponentManager xpcomglue_s_nomozalloc.lib
Error 20 fatal error LNK1120: 5 unresolved externals ..\..\..\firefoxExtension\xpi\components\gecko24\nsWin32Util.dll
Preprocessor:
MOZ_NO_MOZALLOC
XP_WIN
XP_WIN32
Additional Dependency:
xpcomglue_s_nomozalloc.lib
I used to build XPCOM with Gecko 10 and dependency are
nspr4.lib
xpcom.lib
xpcomglue_s_nomozalloc.lib
But I cannot find nspr4.lib and xpcom.lib in Gecko 24, So what's the correct settings for Gecko 24?

Try linking against xul.lib? Note that this is a temporary workaround, though; upstream is getting pretty downright hostile about binary extensions, and you'll probably have better luck doing things via JS-ctypes where possible. Haven't tested that against nomozalloc, though; not sure how well that will work.

Related

How should I deal with "Fatal error LNK1120" when I tried to compile Ipopt-3.9.3 in Windows 10 & Visual C++ 2010

all.
I’m compiling Ipopt-3.9.3 in Windows 10 & Visual C++ 2010 Express.
I’ve built the projects of libCoinBlas, libConHSL, libCoinLapack as well as libIpopt, and generated libCoinBlas.lib, libCoinHSL.lib, libCoinLapack.lib as well as libIpopt.lib in the correct paths but with some warnings.
While when I tried to build the projects of IpoptAmplSolver and hs071_cpp, there exists the following fatal errors.
5>  Generating Code...
5> Creating library Release\IpoptAmplSolver.lib and object Release\IpoptAmplSolver.exp
5>dlarf.obj : error LNK2019: unresolved external symbol _iladlr_ referenced in function _dlarf_
5>dlarfb.obj : error LNK2001: unresolved external symbol _iladlr_
5>dlarf.obj : error LNK2019: unresolved external symbol _iladlc_ referenced in function _dlarf_
5>dlarfb.obj : error LNK2001: unresolved external symbol _iladlc_
5>dlascl.obj : error LNK2019: unresolved external symbol _disnan_ referenced in function _dlascl_
5>dpotf2.obj : error LNK2001: unresolved external symbol _disnan_
5>Release\IpoptAmplSolver.exe : fatal error LNK1120: 3 unresolved externals
========== Rebuild All: 4 succeeded, 1 failed, 0 skipped ==========
5>------ Rebuild All started: Project: hs071_cpp, Configuration: Release Win32 ------
5>  hs071_main.cpp
5>  hs071_nlp.cpp
5>  Generating Code...
5>dlarf.obj : error LNK2019: unresolved external symbol _iladlr_ referenced in function _dlarf_
5>dlarfb.obj : error LNK2001: unresolved external symbol _iladlr_
5>dlarf.obj : error LNK2019: unresolved external symbol _iladlc_ referenced in function _dlarf_
5>dlarfb.obj : error LNK2001: unresolved external symbol _iladlc_
5>dlascl.obj : error LNK2019: unresolved external symbol _disnan_ referenced in function _dlascl_
5>dpotf2.obj : error LNK2001: unresolved external symbol _disnan_
5>LIBCMT.lib(wincrt0.obj) : error LNK2019: unresolved external symbol _WinMain#16 referenced in function ___tmainCRTStartup
5>Release\hs071_cpp.exe : fatal error LNK1120: 4 unresolved externals
========== Rebuild All: 4 succeeded, 1 failed, 0 skipped ==========
Is there anyone who can kindly tell me how should I deal with it?
Thank you very much for your attention, and I’m looking forward to your kind aid.
Finally, I've solved this problem which is due to the undefined functions. I think my case is about a released software package rather than some specific procedure code, hence, it's a little different and relative simple.
Without knowing the specifics of the libraries you are using, I recommend that you try the following to deal with this error:
The error tells you that the linker is missing code for some function calls. This probably means that a library file is not found. Make sure that the linker can find all needed lib files. Check the property pages. Under the Linker->General->Additional library directories, make sure that the directories where your lib-files are located are present and under Linker->Input->Additional dependencies, make sure that the the lib-files are listed. Also make sure that the parameters are present for the different Configurations.
If this still does not help, check if your libraries depend on other libraries. These should be mentioned in the documentation of the libraries you are using.
I've not built this, but here's what I would try from the start. From what you've said, you've compiled the .lib files that it links against and it's failing during linking.
So here are your options...
1) You've either missed a .lib file in the input list for the linker.
2) The actual .lib file doesn't contain the symbol that the linker needs (you can check this by dumping the symbols of the .lib file)
3) Your .lib file is compiled with either the wrong platform than what you're linking with or with the wrong type ie. release/debug.
4) The symbols in your lib are decorated because you're compiling as C++ instead of C, or visa-versa.
If you go through the above steps above, I'm pretty sure you'll find your problem, but you've not really given enough information to properly answer your question. Personally, I'd have a guess that you're compiling C as C++ or you've got the wrong platform type set for one of your lib files.
Thank you all very much for your patient and detailed advices that inspired me, and I finally find out that I should add some C files which define the necessary functions into my project. The detailed solution is as follows.
For example, I want to eliminate
5>dlarf.obj : error LNK2019: unresolved external symbol _iladlr_ referenced in function _dlarf_
5>dlarfb.obj : error LNK2001: unresolved external symbol _iladlr_
Step 1: Run
f2c iladlr.f
In the Visual Stuido Command Prompt and generate iladlr.c.
Step 2: Add iladlr.c to my project.
Step 3: Rebuild.
Finally, everything goes well.

in search of libraries for visual studios 2013, where & how to obtain

i have found some source file online and the individual responsible for it hasn't reply back, i need to know how does one go about finding this particular libraries if one was to need in the near future?
in processing its easy you just go to the library download manager and type the name of that library.
is there a way to do this in Visual studios?
below you can see what i think i need to fix my issue.
#include<opencv/cvaux.h>// in need of it
#include<opencv/cxcore.h>//in need of it
this is why i think i need those files above,
ERRORS:
Error 4 error LNK2019: unresolved external symbol cvReleaseMemStorage
referenced in function
main
Error 2 error LNK2019: unresolved external symbol cvInRangeS
referenced in function
main
Error 5 error LNK2019: unresolved external symbol cvGetSeqElem
referenced in function
main
Error 3 error LNK2019: unresolved external symbol cvCreateMemStorage
referenced in function
main
Error 1 error LNK2019: unresolved external symbol cvCreateImage
referenced in function
main
Error 6 error LNK2019: unresolved external symbol cvCircle referenced
in function
main
Error 7 error LNK1120: 6 unresolved
externals
1>Source.obj : error LNK2019: unresolved external symbol cvCreateMemStorage referenced in function main
1>Source.obj : error LNK2019: unresolved external symbol cvReleaseMemStorage referenced in function main
1>Source.obj : error LNK2019: unresolved external symbol cvGetSeqElem referenced in function main
1>Source.obj : error LNK2019: unresolved external symbol cvCircle referenced in function main
the funny thing is that there's no squiggly red lines in the code telling me that this! is whats wrong, this is why im guessing that the problem is cuz of the lacking of those files.
For starting the development process using libraries like OpenCV or OpenGL,you need to install some packages and do a bunch of configurations on your Visual Studio.From here you can download the missing packages for windows,you can also have a Quick start on the website which will get you on the path for beginning,to be more specific here is a complete guide of building OpenCV apps inside Visual Studio

Chromium Embedded Framework VS2013 strings error

I am converting a project which uses CEF, from VS2010 Express to VS2013 Express. I recompiled libcef_d.lib and libcef_dll_wrapper_d.lib with VS2013 just fine. But now I have problems when I try to link the libs in my main project. How can I resolve this?
WebBrowser_Handler.obj : error LNK2001: unresolved external symbol _cef_string_utf16_clear
WebBrowserManager.obj : error LNK2001: unresolved external symbol _cef_string_utf16_clear
libcef_dll_wrapper_d.lib(browser_ctocpp.obj) : error LNK2001: unresolved external symbol __imp__cef_string_list_alloc
libcef_dll_wrapper_d.lib(cookie_manager_ctocpp.obj) : error LNK2001: unresolved external symbol __imp__cef_string_list_alloc
libcef_dll_wrapper_d.lib(drag_data_ctocpp.obj) : error LNK2001: unresolved external symbol __imp__cef_string_list_alloc
First, make sure that libcef_dll_wrapper uses the same runtime library as your project: http://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx.
Second, if you build CEF from source code and you'd changed something in CEF include folder, you need to run the translator tool:
cd x:\path\to\cef\tool
translator.bat

'LIBCMT' conflicts with use of other libs + unresolved external symbols

I have a program using OpenGL 3.2(+libs) and FreeType2. Then an other program with Boost and OpenSSL. The OpenGL side was to make sure text could be rendered and the boost/openssl program is to do a secure login/game server.
Both programs work fine by them selfs.
However adding Boost and OpenSSL to the game(GL + freetype) project caused it to fail to link.
I have linked the following libs as well as including there includes folder.
glimg.lib
glutil.lib
glfw.lib
opengl32.lib
freetype.lib
glew32.lib
user32.lib
libeay32.lib
ssleay32.lib
The linker error is.
1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>libeay32.lib(cryptlib.obj) : error LNK2001: unresolved external symbol __imp__DeregisterEventSource#4
1>libeay32.lib(cryptlib.obj) : error LNK2001: unresolved external symbol __imp__ReportEventA#36
1>libeay32.lib(cryptlib.obj) : error LNK2001: unresolved external symbol __imp__RegisterEventSourceA#8
1>libeay32.lib(rand_win.obj) : error LNK2001: unresolved external symbol __imp__DeleteDC#4
1>libeay32.lib(rand_win.obj) : error LNK2001: unresolved external symbol __imp__DeleteObject#4
1>libeay32.lib(rand_win.obj) : error LNK2001: unresolved external symbol __imp__GetBitmapBits#12
1>libeay32.lib(rand_win.obj) : error LNK2001: unresolved external symbol __imp__BitBlt#36
1>libeay32.lib(rand_win.obj) : error LNK2001: unresolved external symbol __imp__GetObjectA#12
1>libeay32.lib(rand_win.obj) : error LNK2001: unresolved external symbol __imp__SelectObject#8
1>libeay32.lib(rand_win.obj) : error LNK2001: unresolved external symbol __imp__CreateCompatibleBitmap#12
1>libeay32.lib(rand_win.obj) : error LNK2001: unresolved external symbol __imp__GetDeviceCaps#8
1>libeay32.lib(rand_win.obj) : error LNK2001: unresolved external symbol __imp__CreateCompatibleDC#4
1>libeay32.lib(rand_win.obj) : error LNK2001: unresolved external symbol __imp__CreateDCA#16
1>.\BasicTexture.exe : fatal error LNK1120: 13 unresolved externals
Runtime Library is set to Multi-threaded DLL (/MD)
I have no idea what to do I would really appreciate any help.
You are trying to compile with /MD, which is probably the right choice, but some code (probably one of the libraries) was built with /MT, and you can't have it both ways in the same program. You need to figure out which library was built with /MT and rebuild it with /MD.
Unresolved external error messages are produced when the compiler generates code referencing externally defined objects or functions and the linker fails to find those. To generate code invoking a function call the compiler only needs a declaration:
extern "C" BOOL DeregisterEventSource ( HANDLE hEventLog );
This is enough information to produce a call instruction (except for the target address). The extern keyword informs the compiler that the implementation is defined elsewhere. Consequently it cannot know the target address which has to be filled in later. When the compiler is done it is the linker's job to connect the pieces together. It uses the information gathered from the import libraries to look up the required offsets.
Windows API calls are easily spotted in the error log. They have an __imp__ prefix and sometimes an A or W postfix followed by #<n> where <n> indicates the number of bytes required for the arguments. In the case of a Windows API call you can then look up the function in the MSDN (like DeregisterEventSource). Towards the bottom are the Requirements where you can find the import library name.
The conflict warning indicates that not all of the modules use the same runtime library. Even though this is just a warning it is a serious issue and should be resolved. You get this warning if you mix /MD and /MT compiler switches, but also, if you mix release and debug runtime libraries (like /MD and /MDd). To diagnose this message you can use the /VERBOSE:LIB linker switch to determine which libraries the linker is searching. Additional information on this warning can be found at this MSDN link.

OpenGL compiling issues

I am using Visual Studio C++ and GLEW. The Project Settings are all set (Includes/Libs).
MenuState.obj : error LNK2001: unresolved external symbol __imp____glewUseProgramObjectARB
MenuState.obj : error LNK2001: unresolved external symbol __imp____glewLinkProgramARB
MenuState.obj : error LNK2001: unresolved external symbol __imp____glewAttachObjectARB
MenuState.obj : error LNK2001: unresolved external symbol __imp____glewCompileShader
MenuState.obj : error LNK2001: unresolved external symbol __imp____glewShaderSource
MenuState.obj : error LNK2001: unresolved external symbol __imp____glewCreateShader
MenuState.obj : error LNK2001: unresolved external symbol __imp____glewCreateProgramObjectARB
These are the only Messages I get. Everything worked fine until I tried to implement a Shader.
The Problem is I am working within a VM, so my question is: Does GLEW need opengl32.lib as a dependency? Because if I dont add the opengl32.lib to the Linker I get even more errors. And if so could the Problem be caused by the opengl32.lib? Because I think the opengl32.lib is the standard windows opengl32.lib, that would mean it's only opengl 1.1, and therefor it can't link...
So what is the issue about these errors?
Make sure to #define GLEW_STATIC in the project before including GLEW in Windows. Then you can just include the entire source code in your project files. Otherwise, you need to have the proper GLEW DLL file in with your executable.