I am a beginner in C++ and I am trying to build ssh.dll on Windows 32bit using Visual Studio 2017 and cmake. I have downloaded the latest version of libssh and tried to build ssh.dll from the source by using cmake after configuring and generating as per the recommended steps.
After generating, I opened the libssh solution file with Visual Studio 2017 and build it but while compiling it gave few missing library errors which I resolved by adding those libraries to the VC path.
After adding those libraries, it started giving me around 600 compilation errors like below related to syntax (but syntax looks correct in these library files) .
Is there a way or suggestion by which I can successfully resolve them and create .dll file ?
Below are some of those errors:
Severity Code Description Project File Line Suppression State
Error C2146 syntax error: missing ')' before identifier 'session' ssh_shared c:\apps\mvs15\vc\tools\msvc\14.10.25017\include\libssh\priv.h 196
Error C2061 syntax error: identifier 'channel' ssh_shared c:\apps\mvs15\vc\tools\msvc\14.10.25017\include\libssh\callbacks.h 64
Error C2059 syntax error: ';' ssh_shared c:\apps\mvs15\vc\tools\msvc\14.10.25017\include\libssh\callbacks.h 64
Error C2146 syntax error: missing ')' before identifier 'fd' ssh_shared c:\apps\mvs15\vc\tools\msvc\14.10.25017\include\libssh\libssh.h 656
Error C2059 syntax error: ')' ssh_shared c:\apps\mvs15\vc\tools\msvc\14.10.25017\include\libssh\libssh.h 597
Error C2081 'socket_t': name in formal parameter list illegal ssh_shared c:\apps\MVS15\VC\Tools\MSVC\14.10.25017\include\libssh\poll.h 135
Error C2059 syntax error: '}' ssh_shared c:\apps\MVS15\VC\Tools\MSVC\14.10.25017\include\libssh\session.h 203
Error C2146 syntax error: missing ')' before identifier 'fd' ssh_shared c:\apps\MVS15\VC\Tools\MSVC\14.10.25017\include\libssh\socket.h 36
Error C2059 syntax error: ';' ssh_shared c:\apps\mvs15\vc\tools\msvc\14.10.25017\include\libssh\callbacks.h 64
Error C2037 left of 'iqmp' specifies undefined struct/union 'rsa_st' ssh_shared C:\apps\vcpkg\downloads\libssh-0.7.6.tar\libssh-0.7.6\src\libcrypto-compat.c 77
Error C2037 left of 'dmq1' specifies undefined struct/union 'rsa_st' ssh_shared C:\apps\vcpkg\downloads\libssh-0.7.6.tar\libssh-0.7.6\src\libcrypto-compat.c 76
In order to resolve it, I also tried to replace the questionable library files with other version of these library files, but without any luck. What can I try next?
I just git a git clone and build it successfully.
Here is how I did it.
vcpkg install zlib:x64-windows openssl:x64-windows
# in vcpkg installed directory:
mkdir build
cd build
cmake .. -DCMAKE_GENERATOR_PLATFORM=x64 "-DCMAKE_TOOLCHAIN_FILE=C:/dev/vcpkg/scripts/buildsystems/vcpkg.cmake"
For static linking include
-DVCPKG_TARGET_TRIPLET=x86-windows-static
Open the solution file in Visual Studio 2017 and it successfully builds.
2> Creating library ssh.lib
2>ssh_shared.vcxproj -> ....\build\src\Debug\ssh.dll
========== Build: 7 succeeded, 0 failed, 0 up-to-date, 4 skipped ==========
If you want to build for 32 bit architecture
vcpkg install zlib openssh
in the cloned source code
mkdir build
cd build
cmake .. "-DCMAKE_TOOLCHAIN_FILE=C:/dev/vcpkg/scripts/buildsystems/vcpkg.cmake"
Related
Background -
I'm using Tomcat 9.0.8 as webserver for an Oracle APEX installation. I now need to make Tomcat FIPS-140 compliant. To this end, I'm trying to build the Tomcat Native Library, incorporating a FIPS-compliant OpenSSL. I've been working from these instructions:
https://www.ysofters.com/2017/07/25/building-and-using-fips-capable-openssl-in-apache-tomcat/
There are "official" Tomcat Native build instructions from Apache, but they require the use of Mladen's Custom Microsoft Compiler Toolkit Compilation, which AFAIK can't be built on Windows 10.
The build steps were as follows:
Build the OpenSSL FIPS Object Module
Build the FIPS capable OpenSSL
Build Apache Portable Runtime
Build Tomcat Native library
The last step is what failed, hence my question today.
Build Configuration -
Windows 10 SDK (10.0.19041.0)
Visual Studio Community 2019 Version 16.9.6
Build Errors -
According to the build docs, I needed to run the following nmake command:
nmake -f NMAKEMakefile WITH_APR=E:\native_build\deps\apr WITH_OPENSSL=E:\native_build\deps\openssl APR_DECLARE_STATIC=1 ENABLE_OCSP=1 WITH_FIPS=1
E:\native_build\deps contains compiled versions of Apache Portable Runtime and OpenSSL, built in the previous steps.
That nmake command results in these errors:
E:\Windows Kits\10\include\10.0.19041.0\um\fileapi.h(1105): error C2146: syntax error: missing ')' before identifier 'FileInformationClass'
E:\Windows Kits\10\include\10.0.19041.0\um\fileapi.h(1105): error C2081: 'FILE_INFO_BY_HANDLE_CLASS': name in formal parameter list illegal
E:\Windows Kits\10\include\10.0.19041.0\um\fileapi.h(1105): error C2061: syntax error: identifier 'FileInformationClass'
E:\Windows Kits\10\include\10.0.19041.0\um\fileapi.h(1105): error C2059: syntax error: ';'
E:\Windows Kits\10\include\10.0.19041.0\um\fileapi.h(1105): error C2059: syntax error: ','
E:\Windows Kits\10\include\10.0.19041.0\um\fileapi.h(1108): error C2059: syntax error: ')'
E:\Windows Kits\10\include\10.0.19041.0\um\winbase.h(9118): error C2146: syntax error: missing ')' before identifier 'FileInformationClass'
E:\Windows Kits\10\include\10.0.19041.0\um\winbase.h(9118): error C2081: 'FILE_INFO_BY_HANDLE_CLASS': name in formal parameter list illegal
E:\Windows Kits\10\include\10.0.19041.0\um\winbase.h(9118): error C2061: syntax error: identifier 'FileInformationClass'
E:\Windows Kits\10\include\10.0.19041.0\um\winbase.h(9118): error C2059: syntax error: ';'
E:\Windows Kits\10\include\10.0.19041.0\um\winbase.h(9118): error C2059: syntax error: ','
E:\Windows Kits\10\include\10.0.19041.0\um\winbase.h(9121): error C2059: syntax error: ')'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX64\x64\cl.EXE"' : return code '0x2'
I haven't been able to locate a solution to this, or even another instance of the problem, so hoping you folks have some insights.
I am trying to compile (by porting) some code in Windows 10 that was originally developed for Linux.
The code depends on 2 external libraries: cppkafka and librdkafka.
I saw that vcpkg is able to get the libraries, compile them, and then make them automatically available in Visual Studio 2015 (through the vcpkg integrate install command).
I see that the vcpkg compiles the dependencies for windows 64 (cppkafka and librdkafka) properly, as the .dll, .lib... are all made available on the install folder of vcpkg.
When I try compiling my code in Visual Studio 2015, I see errors concerning the dependencies headers, which for me is unexpected. If vcpkg compiled them, why Visual Studio doesn't? From the vcpkg documentation, I assume they use the same compiler. Next I show some example errors I am getting:
1>------ Build started: Project: AndreKafkaDriver, Configuration: Release x64 ------
1>C:\...\vcpkg\installed\x64-windows\include\librdkafka/rdkafka.h(64): error C2371: 'ssize_t': redefinition; different basic types
1> C:\Siemens\Automation\WinCC_OA\3.16\api\include\winnt\win32.h(47): note: see declaration of 'ssize_t'
1>c:\...\vcpkg\installed\x64-windows\include\cppkafka\header_list.h(265): warning C4267: 'argument': conversion from 'size_t' to 'ssize_t', possible loss of data
1>C:\...\vcpkg\installed\x64-windows\include\cppkafka/utils/buffered_producer.h(1035): error C2065: 'queue1': undeclared identifier
1>C:\...\vcpkg\installed\x64-windows\include\cppkafka/utils/buffered_producer.h(1035): error C2065: 'queue2': undeclared identifier
1>C:\...\vcpkg\installed\x64-windows\include\cppkafka/utils/buffered_producer.h(1035): error C2065: 'mutex': undeclared identifier
1>C:\...\vcpkg\installed\x64-windows\include\cppkafka/utils/buffered_producer.h(1035): error C2275: 'std::mutex': illegal use of this type as an expression
1>C:\...\vcpkg\installed\x64-windows\include\cppkafka/utils/buffered_producer.h(1035): note: see declaration of 'std::mutex'
1>C:\...\vcpkg\installed\x64-windows\include\cppkafka/utils/buffered_producer.h(1035): error C2182: 'swap_queues': illegal use of type 'void'
1>C:\...\vcpkg\installed\x64-windows\include\cppkafka/utils/buffered_producer.h(1035): error C2470: 'cppkafka::BufferedProducer<BufferType,Allocator>::swap_queues': looks like a function definition, but there is no parameter list; skipping apparent body
1>C:\...\vcpkg\installed\x64-windows\include\cppkafka/utils/buffered_producer.h(1035): error C2072: 'cppkafka::BufferedProducer<BufferType,Allocator>::swap_queues': initialization of a function
1>kafkaHWService.cxx(29): fatal error C1083: Cannot open include file: 'execinfo.h': No such file or directory
...
Thanks in advance,
Nerea
I have built soapclient.cpp using GSoap libraries all built successfully, without any errors. Now included the necessary files to the project as instructed by the guide (http://www.genivia.com/dev.html#Example_gSOAP_client_(C++)), but getting following errors, included some here. has anyone come across it, any ideas?
i am using gSoap release 2.8.27
Includes:
soapH.h
soapStub.h
soapSubscribeNetBindingProxy.h
stdsoap2.h
SubscribeNetBinding.nsmap
soapC.cpp, soapClient.cpp, and stdsoap2.cpp
Errors---
Error 1 error C2079: 'soap_tmp_ns__echoString' uses undefined struct 'soap_call_ns__echoString::ns__echoString' c:\dev\riedel\riedellicencemanager\riedellicencemanager\subscribenetproxy\soapclient.cpp 23
Error 2 error C2228: left of '.inputString' must have class/struct/union c:\dev\riedel\riedellicencemanager\riedellicencemanager\subscribenetproxy\soapclient.cpp 27
Error 3 error C3861: 'soap_serialize_ns__echoString': identifier not found c:\dev\riedel\riedellicencemanager\riedellicencemanager\subscribenetproxy\soapclient.cpp 29
Error 4 error C3861: 'soap_put_ns__echoString': identifier not found c:\dev\riedel\riedellicencemanager\riedellicencemanager\subscribenetproxy\soapclient.cpp 36
Error 5 error C3861: 'soap_put_ns__echoString': identifier not found c:\dev\riedel\riedellicencemanager\riedellicencemanager\subscribenetproxy\soapclient.cpp 47
Error 6 error C3861: 'soap_get_ns__echoStringResponse': identifier not found c:\dev\riedel\riedellicencemanager\riedellicencemanager\subscribenetproxy\soapclient.cpp 60
Error 7 error C2027: use of undefined type 'soap_call_ns__echoString::ns__echoStringResponse' c:\dev\riedel\riedellicencemanager\riedellicencemanager\subscribenetproxy\soapclient.cpp 67
Error 8 error C2227: left of '->_return' must point to class/struct/union/generic type c:\dev\riedel\riedellicencemanager\riedellicencemanager\subscribenetproxy\soapclient.cpp 67 }
Do the following.
Remove any references to stdafx.h, from the project
Remove soapClient.cpp
Make sure each cpp file included is to 'Not using pre-compiled headers'
Include dom.h
Include dom.cpp
Project should compile now. if need further help start from calc_vs2005 project included in the gSoap.
Hi Im trying to compile a c++ file viz. mysql.cpp for connecting Matlab to mysql database.
I used the same file before and was able to compile it without any issue but I had to re-install Matlab yesterday and when I tried compiling the file, I get many syntax errors although I have not made any changes in the cpp file.
For reference, the file was taken from here: -
http://www.mathworks.com/matlabcentral/fileexchange/8663-mysql-database-connector
I get the following errors:-
Error mysql.cpp: 57 illegal initialization for parameter 'n'
Error mysql.cpp: 98 syntax error; found 't' expecting ')'
Error mysql.cpp: 98 skipping 't'
Error mysql.cpp: 100 undeclared identifier 't'
Warning mysql.cpp: 100 possible usage of t before definition
Error mysql.cpp: 177 syntax error; found 'int' expecting ';'
Error mysql.cpp: 177 syntax error; found 'int' expecting ';'
Error mysql.cpp: 177 syntax error; found 'int' expecting ')'
Error mysql.cpp: 177 skipping 'int'
Error mysql.cpp: 177 undeclared identifier 'j'
Warning mysql.cpp: 177 Statement has no effect
Warning mysql.cpp: 177 unreachable code
Error mysql.cpp: 177 syntax error; found ')' expecting ';'
Error mysql.cpp: 177 illegal statement termination
Error mysql.cpp: 177 skipping ')'
Error mysql.cpp: 183 syntax error; found 'int' expecting ';'
Error mysql.cpp: 183 syntax error; found 'int' expecting ';'
Error mysql.cpp: 183 syntax error; found 'int' expecting ')'
Error mysql.cpp: 183 skipping 'int'
Error mysql.cpp: 183 undeclared identifier 'j'
Warning mysql.cpp: 183 Statement has no effect
Warning mysql.cpp: 183 unreachable code
Error mysql.cpp: 183 syntax error; found ')' expecting ';'
Error mysql.cpp: 183 illegal statement termination
Error mysql.cpp: 183 skipping ')'
Error mysql.cpp: 186 too many errors
I did the setup for mex using
mex -setup
and used the following command for compilation: -
mex -DWIN32 -I'D:\Softwares\MY SQL\mysql-5.6.12-win32\mysql-5.6.12-win32\include'
-L'D:\Softwares\MY SQL\mysql-5.6.12-win32\mysql-5.6.12-win32\lib' -llibmysql mysql.cpp
Any help is greatly appreciated!!
You could follow this by Chuck Saunders:
Here's how I got this to work on Matlab R2015a installed on a 64 bit Windows 7 install. I started with no compiler and no SQL installed:
Search for the "MySQL Community Installer", download it, then have it install the "full" option.
Check Add/Remove programs to see if you have Microsoft Visual C++ 2010 Redistributable packages installed, BOTH the (x86) and the (x64) packages will cause the Windows SDK 7.1 install to fail.
If you have them, search for the "Microsoft Fix It" utility. Run it, selecting "Uninstall", and use it to uninstall all of the VC++ 2010 redistributables.
Download and install Windows SDK. If the install fails and you didn't bother to run the Fix It utility, I told you so!
Once the Windows SDK is installed, you have to configure it. Go to Start->All Programs->Microsoft Windows SDK X.Y->Visual Studio Registration->Windows SDK Configuration Tool
If the config tool yells that you don't have Visual Studio 2005 or 2008 installed... go install it. I installed VS 2008.
Once all of this is done, on the Matlab prompt, type the line, "mex -setup", and verify that Windows SDK shows as an option and is selected (if you have other compilers - I only got this to work for me with the SDK so I can't comment re:anything else)
Now, making sure the 'mysql.m' and 'mysql.cpp' is in a folder on the Matlab path, run the compile command exactly as shown in the 'mysql.m' comments. For me, the path to my include and library files was: "C:\Program Files\MySQL\MySQL Server 5.6\" and then either "bin\" or "lib\" as appropriate for the command.
For your reference, that full command FOR ME was: mex -I"C:\Program Files\MySQL\MySQL Server 5.6\include" -DWIN32 mysql.cpp "C:\Program Files\MySQL\MySQL Server 5.6\lib\libmySQL.lib"
Again, this relies on using whatever version of MySQL that YOU have installed, so if you don't have MySQL 5.6 installed then you need to modify this command to point to the correct location.
At this point, the file should compile correctly, but you may get an error like several people below have gotten: "Invalid MEX-file :
The specified module could not be found" This error is because you have not copied the 'libmysql.dll' file from your \lib\ folder to whichever folder has the mysql.mex file. Once you do this, it should work!
Finally, for your reference, to be explicit, I have 'mysql.cpp', 'mysql.m', 'mysql.mexw64' all in my root Matlab folder, and then I copied 'libmysql.dll' from "C:\Program Files\MySQL\MySQL Server 5.6\lib\" to my root Matlab folder.
I have been trying recently to get UVC (USB Video Class) extension unit up and running.I did make some progress (by getting vidcap_i.c by a lead from a message from another forum),but I have not been able to go through due to compilation errors and I hope I could get some help here for the subject.
I have created all the necessary files ,which I was guided by the sample at Microsoft site,except the sample application.
Their content is the same as at the UVC sample link.
*Note:I got a little confused by the line that says "Copy Extend.def from the WIA extend sample and edit it. Uvcxuplugn.def should contain".I hope I got it correctly - I have copied the extend.def file from WDK samples directory to
c:\xu directory ,edited the file ,added the necessary content and saved it as Uvcuplugn.def file.
After building using the Build environment ,this is the output of the compilation :
C:\xu>Build -cZg
BUILD: Compile and Link for AMD64
BUILD: Start time:
BUILD: Examining c:\xu directory for files to compile.
c:\xu Invalidating OACR warning log for 'root:amd64chk'
BUILD: Building generated files in c:\xu directory
Configuring OACR for 'root:amd64chk' -
Running MIDL on - interface.idl
BUILD: Compiling c:\xu directory
Compiling - interface_i.c
Compiling - vidcap_i.c
Compiling - uvcxuplgn.cpp
1>errors in directory c:\xu
1>c:\xu\xuproxy.h(69) : error C2017: illegal escape sequence
1>c:\xu\xuproxy.h(71) : error C2059: syntax error : '__uuidof'
1>c:\xu\xuproxy.h(71) : error C2017: illegal escape sequence
1>c:\xu\xuproxy.h(71) : error C2332: 'struct' : missing tag name
1>c:\xu\xuproxy.h(71) : error C2011: '' : 'enum' type redefinition
1>c:\xu\uvcxuplgn.cpp(7) : error C2143: syntax error : missing ';' before '{'
1>c:\xu\uvcxuplgn.cpp(7) : error C2447: '{' : missing function header (old-style
formal list?)
1>c:\xu\uvcxuplgn.cpp(31) : error C2065: 'ObjectMap' : undeclared identifier
Compiling - stdafx.cpp
Compiling - xuproxy.cpp
Building Library - objchk_win7_amd64\amd64\uvcxuplgn.lib
1>link : error LNK1181: cannot open input file 'c:\xu\objchk_win7_amd64\amd64\uv
cxuplgn.obj'
BUILD: Compile errors: not linking c:\xu directory
BUILD: Finish time:
BUILD: Done
12 files compiled - 1 Warning - 8 Errors
1 library built - 1 Error
I get the same errors no matter what the target is (x86,x64,ia64)
Now,let's review errors one by one ,starting from the last :
LNK1181->No idea about that error.I have done clean ups of the build and that did not help
at all.But this is probably the easiest error to resolve,hope you would be able to give me
a lead on the subject.
uvcxuplgn.cpp,Line 7 ,the problematic syntax is :BEGIN_OBJECT_MAP(ObjectMap).
According to Microsoft's documentation (http://msdn.microsoft.com/en-us/library/10fb0d3e(v=vs.90).aspx) , this directive is defined at atlcom.h,which is included
in the file ,so I am really confused about the cause of this error.
The last errors relate to last 5 lines of extension unit proxy header file (cannot post code here due to errors-check this page (http://msdn.microsoft.com/en-us/library/windows/hardware/ff568134(v=vs.85).aspx)
Again,no idea ,why it shouldn't compile.Hope I could get some lead on the subject
Sorry for the long post,hope you could help me (and probably many others) who struggle with this Windows UVC extension unit subject
First, you always have to look at the first error that happens. The others are often following errors. So just delete the wrong escape sequence () in line 69 and in line 71 in xuproxy.h.
The linking error only happens, because the compiler couldnt compile the .cpp files earlier, so the object file is missing.