I am new to visual c++. I am trying to save a label as pdf file in visual c++. I linked pdfsharp dll by add resources from properties. When i run the .exe file in my system, it doesnt give any error. But when the .exe is run in other systems it gives error telling
"could not load file or assembly 'pdfSharp, version=1.31.1789.0, culture = neutral, publicKeytoken= f94615aa0424f9eb' or one of its dependencies"
But when i add the pdfsharp in the folder where this .exe stays, it doesnt give any error. What could be the problem. What should i do to run without adding pdf dll in the .exe folder.
An EXE that links to PDFsharp.dll cannot run without PDFsharp.dll. You can add PDFsharp.dll to a directory listed in the PATH environment variable if you do not want to have it in the EXE folder.
Related
I'm trying to build SQLite as a DLL from sources. In the the "How to" section of the website, they give a simple command line to build it :
cl sqlite3.c -link -dll -out:sqlite3.dll
When I try this command, I get the DLL but not the ".lib" file. With the DLL only I cannot use SQLite inside another dev project. Without the .lib file, there are some symbols missing.
here are some notes i made a while ago on creating a sqlite3.lib file using the contents of sqlitedll-X_X_X.zip (and some other files). This approach might differ from your intended approach - but it may get your project started - I hope it helps.
create \tmp folder in your project directory
find the following 3 files (on the web) and then copy them into the \tmp directory: lib.exe, link.exe, mspdb80.dll
from the latest sqlitedll-X_X_X.zip file (i used: http://www.sqlite.org/sqlitedll-3_7_3.zip) copy sqlite3.def and sqlite3.dll to \tmp directory
open command line (terminal) and navigate to \tmp directory
create .LIB file by typing:
LIB /DEF:sqlite3.def /MACHINE:X86
copy the newly created sqlite3.lib file to your project directory
make sure that the following files are in the project directory:
sqlite3.h (from: http://www.sqlite.org/sqlite-amalgamation-X_X_X.zip)
sqlite3.dll (from: http://www.sqlite.org/sqlitedll-X_X_X.zip)
also
add the sqlite3.h file to the project
make sure that the linker can see sqlite3.lib
For those trying to do this with CMake, and assuming that you are building from amalgamation sources, to produce the .lib file when building a shared variant on Windows you need to add a compile definition SQLITE_API=__declspec(dllexport), for example:
project("SQLite3"
VERSION 3.39.1
DESCRIPTION "Small, fast, self-contained, high-reliability, full-featured SQL database engine"
LANGUAGES C
)
# ...
add_library(${PROJECT_NAME})
# ...
if(BUILD_SHARED_LIBS)
if(WIN32)
target_compile_definitions(${PROJECT_NAME}
PRIVATE
"SQLITE_API=__declspec(dllexport)"
)
else() # haven't tested that
target_compile_definitions(${PROJECT_NAME}
PRIVATE
"SQLITE_API=__attribute__((visibility(\"default\")))"
)
endif()
endif()
# ...
I'm trying to install the extension for Visual Studio 2012 that allows emacs key-bindings.
I'm following through the steps here:
Emacs Keybindings in Visual Studio 2012 or 2013
I'm up to step 5:
Run the vsik file as administrator. This is required so the extension
can write Emacs.vsk into the program files folder. I wasn't sure the
best way to do this so I ran a command prompt as admin and then
executed start emacsemulations.vsik from the prompt.
So, running emacsemulations.vsix from an administrator command prompt,
I get the following error "This VSIX package is invalid because it does not contain the file extension.vsixmanifest at the root."
I'm not changing any of the file names inside the package.
I'm thinking this may have something to do with how windows zips up the file -- I'm able to recreate the problem simply by unzipping and rezipping the EmacsEmulation.vsix file without changing the contents of the vsix package.
If anyone has any suggestions on how to fix, or even better, the actual updated vsix file itself, I'd be very grateful!
The issue you have relies on the way you are zipping your file, what you should do is zip all files inside the folder you created (in this case, "EmacsEmulations") when you unzipped it.
Step into the EmacsEmulations folder.
Select all files.
Add to .zip
Rename the .zip output to EmacsEmulations.vsix
I'm trying to get this extension to work too, so good luck!
I am trying to deploy my C#.Net console application.
Methods i tried.
Build the application
go to bin directory
in debug directory copy the files and move to compressed folder
extract it in different machine and run .exe file
Problem i am having is:
I have used MSXML2 assembly in my project.
I guess this assembly is not copied to bin directory and the machine I am running .exe file doesn't not having this assembly in it.
when i run the .exe it get below error.
System.IO.FileNotFoundException: The system cannot locate the resource specified.
at MSXML2.IXMLHTTPRequest.send(object varbody
at projectname.Program.Main(String[] args))
how can i make sure this assembly is properly loaded to my deployed folder.
thanks for looking in to my question.
applying dotnetengineer suggession
set Copy Local to TRUE
New issue:
Could not load file or assembly 'Interop.MSXML2, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Click on and highlight the reference to MSXML2 in the Soultion Explorer. In the Properties pane, make sure "Copy Local" is set to "True".
Disclaimer: Am a C# developer trying to understand a few C++ fundamentals
Have created a command line project which has the .lib of a DLL file linked under Linker > Input > Additional dependencies, and also has the location of the header files specified under C/C++ > General > Additional Include Directories. Ran a build and all compiled okay, with the .exe being built in the Debug/Release dir.
Problem is I also expected the .dll file the project depends on to be there (just like when you add a reference in a .Net project) - but it isn't. When launching the .exe it complains that it can't find the DLL. Fair enough, but why didn't the VC++ put the DLL there if it knows it's required?
And is there a "best practice" to ensuring the dependent DLL files are in the output dir, other than manually copying them there? I have a project that will require use of some third-party libraries, and I was hoping the IDE would help me manage them...
Big thanks for any guidance given!
If you create solution which contains exe and dll, all output files are created in $(SolutionDir) Debug or Release subdirectories, and exe runs successfully. Otherwise, you have one of the following options:
Copy Dll in Post-build step to directory where it is available for loading (usually .exe directory)
Add Dll directory to PATH.
I'm finding it really difficult to properly link a .lib file to my C++ Win32 Console Application. Here's my problem.
Just as in this MSDN article, I have developed a MathFuncsLib.lib file.
http://msdn.microsoft.com/en-us/library/ms235627%28v=vs.80%29.aspx
Then, in the MyExecRefsLib Win32 Console App, I want to link to the above file. So, inside MyExecRefsLib folder (same folder where .sln file resides) I created a directory called "LibraryFiles" and placed both MathFuncsLib.lib file AND MathFuncsLib.h file.
Then, in Properties->Linker->Input I added both "MathFuncsLib.lib" and "MathFuncsLib.h" (without full path) and then in Properties->Linker->Additional Library Directories I added the path to my folder "LibraryFiles" which is what pretty much EVERY thread on the web about this problem tells me to do.
But now it gives me the following error:
fatal error C1083: Cannot open the
include file. 'MathFuncsLib.h': No
such file or directory.
What am I doing wrong? Please help.
Note that my code is exactly the same as what's in the above given MSDN link.
To link with a .lib file, you just need to:
right clic on the project name, select Properties
under Properties->configuration properties->C/C++->General item "other include directories" add the path to your .h file
under Properties->Linker->Input add the path and name of your .lib file
And that's it.