Building Quickfix on Windows for 64bit - c++

I've downloaded what I believe is the latest Quickfix from Github. It builds fine as an x86 project, but when I try to build it as an x64 project there's a load of warnings (see below).
I can't imagine I'm the first person to want to build a 64bit version of Quickfix. A lot of the warnings look like they're Windows specific (eg casting the SOCKET to int).
Is there a version of Quickfix out there that builds cleanly as a 64bit library on Windows, or will I need to go in and patch it myself?
FieldMap.cpp(205): warning C4267: '+=': conversion from 'size_t' to
'int', possible loss of data FileStore.cpp(135): warning C4477:
'fscanf_s' : format string '%lu' requires an argument of type
'unsigned long *', but variadic argument 3 has type 'size_t *'
FileStore.cpp(135): note: consider using '%zu' in the format string
FileStore.cpp(197): warning C4477: 'fprintf' : format string '%lu'
requires an argument of type 'unsigned long', but variadic argument 3
has type '::size_t' FileStore.cpp(197): note: consider using '%zu' in
the format string
c:\apps\VS2017Pro\VC\Tools\MSVC\14.10.25017\include\utility(239):
warning C4267: '=': conversion from 'size_t' to 'int', possible loss
of data FileStore.cpp(136): note: see reference to function template
instantiation 'std::pair &std::pair::operator
=(std::pair &&)' being compiled FileStore.cpp(136): note: see reference to function template
instantiation 'std::pair &std::pair::operator
=(std::pair &&)' being compiled SocketConnection.cpp(89): warning C4267: '+=': conversion
from 'size_t' to 'unsigned int', possible loss of data
SocketMonitor.cpp(141): warning C4244: '=': conversion from 'double'
to 'long', possible loss of data SocketMonitor.cpp(146): warning
C4244: '=': conversion from 'double' to 'long', possible loss of data
SocketMonitor.cpp(232): warning C4244: 'initializing': conversion from
'SOCKET' to 'int', possible loss of data SocketMonitor.cpp(271):
warning C4244: 'initializing': conversion from 'SOCKET' to 'int',
possible loss of data SocketMonitor.cpp(312): warning C4244:
'initializing': conversion from 'SOCKET' to 'int', possible loss of
data Utility.cpp(105): warning C4244: 'initializing': conversion from
'SOCKET' to 'int', possible loss of data Utility.cpp(128): warning
C4244: 'return': conversion from 'SOCKET' to 'int', possible loss of
data Utility.cpp(139): warning C4996: 'inet_addr': Use inet_pton() or
InetPton() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to
disable deprecated API warnings C:\Program Files (x86)\Windows
Kits\8.1\Include\um\Winsock2.h(1850): note: see declaration of
'inet_addr' Utility.cpp(150): warning C4244: 'return': conversion from
'SOCKET' to 'int', possible loss of data Utility.cpp(155): warning
C4267: 'argument': conversion from 'size_t' to 'int', possible loss of
data Utility.cpp(276): warning C4309: '=': truncation of constant
value Utility.cpp(299): warning C4996: 'inet_ntoa': Use inet_ntop() or
InetNtop() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to
disable deprecated API warnings C:\Program Files (x86)\Windows
Kits\8.1\Include\um\Winsock2.h(1868): note: see declaration of
'inet_ntoa' Utility.cpp(314): warning C4996: 'inet_addr': Use
inet_pton() or InetPton() instead or define
_WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings C:\Program Files (x86)\Windows Kits\8.1\Include\um\Winsock2.h(1850):
note: see declaration of 'inet_addr' Utility.cpp(322): warning C4996:
'gethostbyname': Use getaddrinfo() or GetAddrInfoW() instead or define
_WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings C:\Program Files (x86)\Windows Kits\8.1\Include\um\Winsock2.h(2238):
note: see declaration of 'gethostbyname' Utility.cpp(328): warning
C4996: 'inet_ntoa': Use inet_ntop() or InetNtop() instead or define
_WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings C:\Program Files (x86)\Windows Kits\8.1\Include\um\Winsock2.h(1868):
note: see declaration of 'inet_ntoa' Utility.cpp(337): warning C4996:
'inet_ntoa': Use inet_ntop() or InetNtop() instead or define
_WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings C:\Program Files (x86)\Windows Kits\8.1\Include\um\Winsock2.h(1868):
note: see declaration of 'inet_ntoa' Utility.cpp(399): warning C4244:
'=': conversion from 'uintptr_t' to 'FIX::thread_id', possible loss of
data Utility.cpp(418): warning C4312: 'type cast': conversion from
'FIX::thread_id' to 'void *' of greater size Utility.cpp(419): warning
C4312: 'type cast': conversion from 'FIX::thread_id' to 'HANDLE' of
greater size Utility.cpp(428): warning C4312: 'type cast': conversion
from 'FIX::thread_id' to 'HANDLE' of greater size Utility.cpp(438):
warning C4311: 'type cast': pointer truncation from 'HANDLE' to
'unsigned int' Utility.cpp(438): warning C4302: 'type cast':
truncation from 'HANDLE' to 'unsigned int'
df

Related

How do I prevent the compiler from compiling obvious typos like if (somevalue = 0)? [duplicate]

Is it possible in Visual Studio to get a compiler error for an assignment in an if statement? How?
#include <iostream>
int main()
{
int a = 2;
if (a = 3) // Want a warning here
std::cout << "Avoid this!\n";
}
I know I can switch to Yoda conditions (if (3=a)), but I really don't want to.
I tried: setting the warning level to /Wall but I still don't get a warning that I could then treat as an error.
I am doing this in Visual Studio 2019 (16.11.19).:
The build output is
Rebuild started...
1>------ Rebuild All started: Project: Yoda2019, Configuration: Debug Win32 ------
1>Yoda2019.cpp
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\limits.h(70,5): error C2220: the following warning is treated as an error
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\limits.h(70,5): warning C4668: '__STDC_WANT_SECURE_LIB__' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xmemory(154,5): warning C4365: 'argument': conversion from 'long' to 'unsigned int', signed/unsigned mismatch
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xmemory(164,5): warning C4365: 'argument': conversion from 'long' to 'unsigned int', signed/unsigned mismatch
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\atomic(284,9): warning C4365: 'argument': conversion from 'long' to 'unsigned int', signed/unsigned mismatch
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\atomic(299,9): warning C4365: 'argument': conversion from 'long' to 'unsigned int', signed/unsigned mismatch
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\atomic(315,9): warning C4365: 'argument': conversion from 'long' to 'unsigned int', signed/unsigned mismatch
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\atomic(375,9): warning C4365: 'argument': conversion from 'long' to 'unsigned int', signed/unsigned mismatch
1>Done building project "Yoda2019.vcxproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
and Visual Studio 2022 (17.4.0)
The build output is
Rebuild started...
1>------ Rebuild All started: Project: YodaCheck, Configuration: Debug x64 ------
1>YodaCheck.cpp
1>YodaCheck.vcxproj -> B:\Projekte\C++\Dynamic Linking\YodaCheck\x64\Debug\YodaCheck.exe
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
========== Elapsed 00:01,379 ==========
so I see no warning which I could convert into an error.
You can turn any specific warning into an error, using the #pragma warning(error:nnnn) directive. In your case, the warning is:
warning C4706: assignment within conditional expression
So, adding the relevant #pragma directive to the code will generate a compiler error:
#include <iostream>
#pragma warning(error:4706)
int main()
{
int a = 2;
if (a = 3) // Want a warning here
std::cout << "Avoid this!\n";
}
This now gives:
error C4706: assignment within conditional expression
For a solution wide setting, change it here in the property pages:
Use /W4 /WX
/WX Treats all compiler warnings as errors. For a new project, it may be best to use /WX in all compilations; resolving all warnings ensures the fewest possible hard-to-find code defects.
https://learn.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level?view=msvc-170
Make sure you make that setting in the relevant configurations. In such a simple demo, it's probably easiest to choose "all configurations" and "all platforms".

How to get a compiler error for assignments in an if statement?

Is it possible in Visual Studio to get a compiler error for an assignment in an if statement? How?
#include <iostream>
int main()
{
int a = 2;
if (a = 3) // Want a warning here
std::cout << "Avoid this!\n";
}
I know I can switch to Yoda conditions (if (3=a)), but I really don't want to.
I tried: setting the warning level to /Wall but I still don't get a warning that I could then treat as an error.
I am doing this in Visual Studio 2019 (16.11.19).:
The build output is
Rebuild started...
1>------ Rebuild All started: Project: Yoda2019, Configuration: Debug Win32 ------
1>Yoda2019.cpp
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\limits.h(70,5): error C2220: the following warning is treated as an error
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\limits.h(70,5): warning C4668: '__STDC_WANT_SECURE_LIB__' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xmemory(154,5): warning C4365: 'argument': conversion from 'long' to 'unsigned int', signed/unsigned mismatch
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xmemory(164,5): warning C4365: 'argument': conversion from 'long' to 'unsigned int', signed/unsigned mismatch
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\atomic(284,9): warning C4365: 'argument': conversion from 'long' to 'unsigned int', signed/unsigned mismatch
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\atomic(299,9): warning C4365: 'argument': conversion from 'long' to 'unsigned int', signed/unsigned mismatch
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\atomic(315,9): warning C4365: 'argument': conversion from 'long' to 'unsigned int', signed/unsigned mismatch
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\atomic(375,9): warning C4365: 'argument': conversion from 'long' to 'unsigned int', signed/unsigned mismatch
1>Done building project "Yoda2019.vcxproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
and Visual Studio 2022 (17.4.0)
The build output is
Rebuild started...
1>------ Rebuild All started: Project: YodaCheck, Configuration: Debug x64 ------
1>YodaCheck.cpp
1>YodaCheck.vcxproj -> B:\Projekte\C++\Dynamic Linking\YodaCheck\x64\Debug\YodaCheck.exe
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
========== Elapsed 00:01,379 ==========
so I see no warning which I could convert into an error.
You can turn any specific warning into an error, using the #pragma warning(error:nnnn) directive. In your case, the warning is:
warning C4706: assignment within conditional expression
So, adding the relevant #pragma directive to the code will generate a compiler error:
#include <iostream>
#pragma warning(error:4706)
int main()
{
int a = 2;
if (a = 3) // Want a warning here
std::cout << "Avoid this!\n";
}
This now gives:
error C4706: assignment within conditional expression
For a solution wide setting, change it here in the property pages:
Use /W4 /WX
/WX Treats all compiler warnings as errors. For a new project, it may be best to use /WX in all compilations; resolving all warnings ensures the fewest possible hard-to-find code defects.
https://learn.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level?view=msvc-170
Make sure you make that setting in the relevant configurations. In such a simple demo, it's probably easiest to choose "all configurations" and "all platforms".

Got error message when run a simple tensorflow code after building Tensorflow c++ GPU version

Hey I'm using tensorflow c++. I built tensorflow with this. I built a GPU version. When I run the sample code, I got many errors.
I built tensorflow r2.5 and protobuf-3.9.2.
code:
#include <iostream>
#include <tensorflow/core/framework/graph.pb.h>
#include <tensorflow/core/public/session.h>
#include <tensorflow/core/public/version.h>
int main() {
std::cout << tf_git_version() << std::endl;
std::unique_ptr<tensorflow::Session> session(tensorflow::NewSession({}));
}
errors:
1>------ Build started: Project: TF_savedmodel, Configuration: Release x64 ------
1>Source.cpp
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\framework\attr_value.pb.h(687,1): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\framework\node_def.pb.h(97,1): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\framework\function.pb.h(300,1): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\framework\function.pb.h(332,1): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\framework\function.pb.h(587,1): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\framework\function.pb.h(590,1): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\framework\function.pb.h(621,1): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\framework\function.pb.h(624,1): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
1>D:\tf_model\TF_savedmodel\include\Eigen\src\Core\arch\Default\Half.h(1,1): warning C4819: The file contains a character that cannot be represented in the current code page (950). Save the file in Unicode format to prevent data loss
1>D:\tf_model\TF_savedmodel\include\Eigen\src\Core\arch\Default\BFloat16.h(1,1): warning C4819: The file contains a character that cannot be represented in the current code page (950). Save the file in Unicode format to prevent data loss
1>D:\tf_model\TF_savedmodel\include\Eigen\src\Core\arch\Default\GenericPacketMathFunctions.h(678,1): warning C4819: The file contains a character that cannot be represented in the current code page (950). Save the file in Unicode format to prevent data loss
1>D:\tf_model\TF_savedmodel\include\Eigen\src\Core\products\GeneralBlockPanelKernel.h(2065,1): warning C4819: The file contains a character that cannot be represented in the current code page (950). Save the file in Unicode format to prevent data loss
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\tstring.h(350,40): error C2589: '(': illegal token on right side of '::'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\tstring.h(350): error C2062: type 'unknown-type' unexpected
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\tstring.h(350,56): error C2059: syntax error: ')'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\default\logging.h(383,1): warning C4003: not enough arguments for function-like macro invocation 'max'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\default\logging.h(382,1): error C2589: '(': illegal token on right side of '::'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\default\logging.h(383): error C2062: type 'unknown-type' unexpected
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\default\logging.h(383,1): error C2059: syntax error: ')'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\default\logging.h(383,1): error C2143: syntax error: missing ';' before '{'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\default\logging.h(384,1): warning C4003: not enough arguments for function-like macro invocation 'max'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\default\logging.h(384,1): error C2589: '(': illegal token on right side of '::'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\default\logging.h(384): error C2062: type 'unknown-type' unexpected
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\default\logging.h(384,1): error C2059: syntax error: ')'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\default\logging.h(384,1): error C2143: syntax error: missing ';' before '{'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\default\logging.h(385,1): warning C4003: not enough arguments for function-like macro invocation 'max'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\default\logging.h(385,1): error C2589: '(': illegal token on right side of '::'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\default\logging.h(385): error C2062: type 'unknown-type' unexpected
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\default\logging.h(385,1): error C2059: syntax error: ')'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\default\logging.h(385,1): error C2143: syntax error: missing ';' before '{'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\default\logging.h(386,1): warning C4003: not enough arguments for function-like macro invocation 'max'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\default\logging.h(386,1): error C2589: '(': illegal token on right side of '::'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\default\logging.h(386): error C2062: type 'unknown-type' unexpected
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\default\logging.h(386,1): error C2059: syntax error: ')'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\default\logging.h(386,1): error C2143: syntax error: missing ';' before '{'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\default\logging.h(387,1): warning C4003: not enough arguments for function-like macro invocation 'max'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\default\logging.h(387,1): error C2589: '(': illegal token on right side of '::'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\default\logging.h(387): error C2062: type 'unknown-type' unexpected
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\default\logging.h(387,1): error C2059: syntax error: ')'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\default\logging.h(387,1): error C2143: syntax error: missing ';' before '{'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\default\logging.h(388,1): warning C4003: not enough arguments for function-like macro invocation 'max'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\default\logging.h(388,1): error C2589: '(': illegal token on right side of '::'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\default\logging.h(388): error C2062: type 'unknown-type' unexpected
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\default\logging.h(388,1): error C2059: syntax error: ')'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\default\logging.h(388,1): error C2143: syntax error: missing ';' before '{'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\error_codes.pb.h(80,92): warning C4003: not enough arguments for function-like macro invocation 'min'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\error_codes.pb.h(80,92): error C2589: '(': illegal token on right side of '::'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\error_codes.pb.h(80): error C2062: type 'unknown-type' unexpected
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\error_codes.pb.h(80,92): error C3805: 'type': unexpected token, expected either '}' or a ','
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\error_codes.pb.h(81,92): warning C4003: not enough arguments for function-like macro invocation 'max'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\framework\tensor_shape.h(106,67): warning C4003: not enough arguments for function-like macro invocation 'max'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\framework\tensor_shape.h(106,67): error C2589: '(': illegal token on right side of '::'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\framework\tensor_shape.h(106): error C2062: type 'unknown-type' unexpected
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\framework\tensor_shape.h(106,67): error C2737: 'protected: static __int64 const tensorflow::TensorShapeRep::kMaxRep16': constexpr object must be initialized
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\framework\tensor_shape.h(106,67): error C2059: syntax error: ')'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\framework\tensor_shape.h(107,67): warning C4003: not enough arguments for function-like macro invocation 'max'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\framework\tensor_shape.h(107,67): error C2589: '(': illegal token on right side of '::'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\framework\tensor_shape.h(107): error C2062: type 'unknown-type' unexpected
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\framework\tensor_shape.h(107,67): error C2737: 'protected: static __int64 const tensorflow::TensorShapeRep::kMaxRep32': constexpr object must be initialized
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\framework\tensor_shape.h(107,67): error C2059: syntax error: ')'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\framework\tensor_shape.h(108,72): warning C4003: not enough arguments for function-like macro invocation 'max'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\framework\tensor_shape.h(108,72): error C2589: '(': illegal token on right side of '::'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\framework\tensor_shape.h(108): error C2062: type 'unknown-type' unexpected
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\framework\tensor_shape.h(108,72): error C2737: 'protected: static unsigned short const tensorflow::TensorShapeRep::kUnknownRep16': constexpr object must be initialized
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\framework\tensor_shape.h(108,72): error C2059: syntax error: ')'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\framework\tensor_shape.h(109,72): warning C4003: not enough arguments for function-like macro invocation 'max'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\framework\tensor_shape.h(109,72): error C2589: '(': illegal token on right side of '::'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\framework\tensor_shape.h(109): error C2062: type 'unknown-type' unexpected
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\framework\tensor_shape.h(109,72): error C2737: 'protected: static unsigned int const tensorflow::TensorShapeRep::kUnknownRep32': constexpr object must be initialized
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\framework\tensor_shape.h(109,72): error C2059: syntax error: ')'
1>D:\tf_model\TF_savedmodel\include\unsupported\Eigen\CXX11\src\Tensor\Tensor.h(76,1): warning C4554: '&': check operator precedence for possible error; use parentheses to clarify precedence
1>D:\tf_model\TF_savedmodel\include\unsupported\Eigen\CXX11\src\Tensor\TensorMap.h(43): message : see reference to class template instantiation 'Eigen::Tensor<T,1,1,int>' being compiled
1> with
1> [
1> T=float
1> ]
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\framework\tensor_types.h(105): message : see reference to class template instantiation 'Eigen::TensorMap<Eigen::Tensor<T,1,1,int>,16,Eigen::MakePointer>' being compiled
1> with
1> [
1> T=float
1> ]
1>D:\tf_model\TF_savedmodel\include\google\protobuf\type.pb.h(106,109): warning C4003: not enough arguments for function-like macro invocation 'min'
1>D:\tf_model\TF_savedmodel\include\google\protobuf\type.pb.h(106,109): error C2589: '(': illegal token on right side of '::'
1>D:\tf_model\TF_savedmodel\include\google\protobuf\type.pb.h(106): error C2062: type 'unknown-type' unexpected
1>D:\tf_model\TF_savedmodel\include\google\protobuf\type.pb.h(106,109): error C3805: 'type': unexpected token, expected either '}' or a ','
1>D:\tf_model\TF_savedmodel\include\google\protobuf\type.pb.h(107,109): warning C4003: not enough arguments for function-like macro invocation 'max'
1>D:\tf_model\TF_savedmodel\include\google\protobuf\type.pb.h(133,123): warning C4003: not enough arguments for function-like macro invocation 'min'
1>D:\tf_model\TF_savedmodel\include\google\protobuf\type.pb.h(133,123): error C2589: '(': illegal token on right side of '::'
1>D:\tf_model\TF_savedmodel\include\google\protobuf\type.pb.h(133): error C2062: type 'unknown-type' unexpected
1>D:\tf_model\TF_savedmodel\include\google\protobuf\type.pb.h(133,123): error C3805: 'type': unexpected token, expected either '}' or a ','
1>D:\tf_model\TF_savedmodel\include\google\protobuf\type.pb.h(134,123): warning C4003: not enough arguments for function-like macro invocation 'max'
1>D:\tf_model\TF_savedmodel\include\google\protobuf\type.pb.h(158,94): warning C4003: not enough arguments for function-like macro invocation 'min'
1>D:\tf_model\TF_savedmodel\include\google\protobuf\type.pb.h(158,94): error C2589: '(': illegal token on right side of '::'
1>D:\tf_model\TF_savedmodel\include\google\protobuf\type.pb.h(158): error C2062: type 'unknown-type' unexpected
1>D:\tf_model\TF_savedmodel\include\google\protobuf\type.pb.h(158,94): error C3805: 'type': unexpected token, expected either '}' or a ','
1>D:\tf_model\TF_savedmodel\include\google\protobuf\type.pb.h(159,94): warning C4003: not enough arguments for function-like macro invocation 'max'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\tensor_coding.h(47,38): error C2589: '(': illegal token on right side of '::'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\tensor_coding.h(47): error C2062: type 'unknown-type' unexpected
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\platform\tensor_coding.h(47,62): error C2059: syntax error: ')'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\framework\step_stats.pb.h(1180,1): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\cluster.pb.h(97,1): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\verifier_config.pb.h(72,131): warning C4003: not enough arguments for function-like macro invocation 'min'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\verifier_config.pb.h(72,131): error C2589: '(': illegal token on right side of '::'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\verifier_config.pb.h(72): error C2062: type 'unknown-type' unexpected
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\verifier_config.pb.h(72,131): error C3805: 'type': unexpected token, expected either '}' or a ','
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\verifier_config.pb.h(73,131): warning C4003: not enough arguments for function-like macro invocation 'max'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\rewriter_config.pb.h(94,131): warning C4003: not enough arguments for function-like macro invocation 'min'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\rewriter_config.pb.h(94,131): error C2589: '(': illegal token on right side of '::'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\rewriter_config.pb.h(94): error C2062: type 'unknown-type' unexpected
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\rewriter_config.pb.h(94,131): error C3805: 'type': unexpected token, expected either '}' or a ','
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\rewriter_config.pb.h(95,131): warning C4003: not enough arguments for function-like macro invocation 'max'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\rewriter_config.pb.h(120,137): warning C4003: not enough arguments for function-like macro invocation 'min'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\rewriter_config.pb.h(120,137): error C2589: '(': illegal token on right side of '::'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\rewriter_config.pb.h(120): error C2062: type 'unknown-type' unexpected
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\rewriter_config.pb.h(120,137): error C3805: 'type': unexpected token, expected either '}' or a ','
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\rewriter_config.pb.h(121,137): warning C4003: not enough arguments for function-like macro invocation 'max'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\rewriter_config.pb.h(146,153): warning C4003: not enough arguments for function-like macro invocation 'min'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\rewriter_config.pb.h(146,153): error C2589: '(': illegal token on right side of '::'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\rewriter_config.pb.h(146): error C2062: type 'unknown-type' unexpected
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\rewriter_config.pb.h(146,153): error C3805: 'type': unexpected token, expected either '}' or a ','
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\rewriter_config.pb.h(147,153): warning C4003: not enough arguments for function-like macro invocation 'max'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\rewriter_config.pb.h(176,139): warning C4003: not enough arguments for function-like macro invocation 'min'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\rewriter_config.pb.h(176,139): error C2589: '(': illegal token on right side of '::'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\rewriter_config.pb.h(176): error C2062: type 'unknown-type' unexpected
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\rewriter_config.pb.h(176,139): error C3805: 'type': unexpected token, expected either '}' or a ','
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\rewriter_config.pb.h(177,139): warning C4003: not enough arguments for function-like macro invocation 'max'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\rewriter_config.pb.h(543,1): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\config.pb.h(156,133): warning C4003: not enough arguments for function-like macro invocation 'min'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\config.pb.h(156,133): error C2589: '(': illegal token on right side of '::'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\config.pb.h(156): error C2062: type 'unknown-type' unexpected
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\config.pb.h(156,133): error C3805: 'type': unexpected token, expected either '}' or a ','
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\config.pb.h(157,133): warning C4003: not enough arguments for function-like macro invocation 'max'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\config.pb.h(183,151): warning C4003: not enough arguments for function-like macro invocation 'min'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\config.pb.h(183,151): error C2589: '(': illegal token on right side of '::'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\config.pb.h(183): error C2062: type 'unknown-type' unexpected
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\config.pb.h(183,151): error C3805: 'type': unexpected token, expected either '}' or a ','
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\config.pb.h(184,151): warning C4003: not enough arguments for function-like macro invocation 'max'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\config.pb.h(211,173): warning C4003: not enough arguments for function-like macro invocation 'min'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\config.pb.h(211,173): error C2589: '(': illegal token on right side of '::'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\config.pb.h(211): error C2062: type 'unknown-type' unexpected
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\config.pb.h(211,173): error C3805: 'type': unexpected token, expected either '}' or a ','
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\config.pb.h(212,173): warning C4003: not enough arguments for function-like macro invocation 'max'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\config.pb.h(238,131): warning C4003: not enough arguments for function-like macro invocation 'min'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\config.pb.h(238,131): error C2589: '(': illegal token on right side of '::'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\config.pb.h(238): error C2062: type 'unknown-type' unexpected
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\config.pb.h(238,131): error C3805: 'type': unexpected token, expected either '}' or a ','
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\config.pb.h(239,131): warning C4003: not enough arguments for function-like macro invocation 'max'
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\config.pb.h(1951,1): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\config.pb.h(3797,1): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\config.pb.h(3800,1): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\config.pb.h(3831,1): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\protobuf\config.pb.h(3834,1): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
1>D:\tf_model\TF_savedmodel\include\tensorflow\core\public\session_options.h(62,2): warning C4091: '__declspec(dllimport)': ignored on left of 'tensorflow::SessionOptions' when no variable is declared
1>Done building project "TF_savedmodel.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Some said this happened because of "Windows.h", but I didn't saw such a include command in these header files. Should I edit some of those files?
If someone could tell me how to solve that, it will be nice.
[solved] just add () to following files which using std::XXX::min/ max().

How to import existing OpenSsl project into Xcode

I would like to modify the existing Openssl project. So I downloaded the source code of openssl from GitHub https://github.com/openssl/openssl
and follow the instruction http://openssl.6102.n7.nabble.com/Easy-inclusion-of-OpenSSL-into-iOS-projects-agileinfoways-com-td48905.html on how to include Openssl into Xcode.
However, when i tried to build one of the file (enc.c) from OpenSsl project, it run into 6 errors and 7 warning.
/usr/local/opt/openssl/include/openssl/ecdsa.h
/usr/local/opt/openssl/include/openssl/ecdsa.h:295:14: Parameter
'flags' not found in the function declaration
/usr/local/opt/openssl/include/openssl/ecdsa.h:301:14: Parameter
'ecdsa_method' not found in the function declaration
/usr/local/opt/openssl/include/openssl/ecdsa.h:302:14: Parameter 'name' not found in the function declaration
/Users/maggie/Documents/aes/openssl-master/apps/apps.h
/Users/maggie/Documents/aes/openssl-master/apps/apps.h:421:1: Unknown type name '__owur'
/Users/maggie/Documents/aes/openssl-master/apps/apps.h:421:8: Expected identifier or '('
/Users/maggie/Documents/aes/openssl-master/apps/apps.h:432:1: Unknown type name '__owur'
/Users/maggie/Documents/aes/openssl-master/apps/apps.h:432:8: Expected identifier or '('
/Users/maggie/Documents/aes/openssl-master/apps/progs.h
/Users/maggie/Documents/aes/openssl-master/apps/progs.h:25:1: Type specifier missing, defaults to 'int'
/Users/maggie/Documents/aes/openssl-master/apps/enc.c
/Users/maggie/Documents/aes/openssl-master/apps/enc.c:542:47: Expected ')'
/Users/maggie/Documents/aes/openssl-master/apps/enc.c:543:47: Expected ')'
/Users/maggie/Documents/aes/openssl-master/apps/enc.c:427:33: Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int'
/Users/maggie/Documents/aes/openssl-master/apps/enc.c:597:28: Implicit declaration of function 'OPENSSL_hexchar2int' is invalid in C99
/Users/maggie/Documents/aes/openssl-master/apps/enc.c:582:9: Implicit conversion loses integer precision: 'unsigned long' to 'int'
Source code of enc.c is here
Does anyone ever encounter this problem?
Thanks.

Visual Studio + Boost error

I'm trying to build a solution using Boost in Visual Studio C++ Express 2010 and get the following error:
1>------ Build started: Project: MEDsLDAc, Configuration: Release Win32 ------
1> MedLDA.cpp
1>D:\_download\boost_1_53_0\boost/math/constants/calculate_constants.hpp(152): error C2988: unrecognizable template declaration/definition
1>D:\_download\boost_1_53_0\boost/math/constants/calculate_constants.hpp(152): error C2059: syntax error : 'constant'
1>D:\_download\boost_1_53_0\boost/math/constants/calculate_constants.hpp(153): error C2143: syntax error : missing ')' before '>'
1>D:\_download\boost_1_53_0\boost/math/constants/calculate_constants.hpp(184): error C2244: 'boost::math::constants::detail::constant_euler<T>::compute' : unable to match function definition to an existing declaration
1> definition
1> 'T boost::math::constants::detail::constant_euler<T>::compute(void)'
1> existing declarations
1> 'T boost::math::constants::detail::constant_euler<T>::compute(void)'
1>MedLDA.cpp(385): warning C4244: 'initializing' : conversion from 'double' to 'long', possible loss of data
1>MedLDA.cpp(426): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(105) : see declaration of 'strcpy'
1>MedLDA.cpp(485): warning C4244: 'initializing' : conversion from 'double' to 'long', possible loss of data
1>MedLDA.cpp(608): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(105) : see declaration of 'strcpy'
1>MedLDA.cpp(609): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(105) : see declaration of 'strcpy'
1>MedLDA.cpp(636): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(105) : see declaration of 'strcpy'
1>MedLDA.cpp(730): warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
1>MedLDA.cpp(963): warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
1>MedLDA.cpp(1150): warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data
1>MedLDA.cpp(1241): warning C4244: 'initializing' : conversion from 'double' to 'long', possible loss of data
1>MedLDA.cpp(1296): warning C4244: 'initializing' : conversion from 'double' to 'long', possible loss of data
========== Build: 0 succeeded, 1 failed, 2 up-to-date, 0 skipped ==========
How to fix it?
UPDATE: the software is MedLDAc available here:
http://www.ml-thu.net/~jun/medlda.shtml
The author says building works for him.
Since you haven't shown any code, we can only guess. My guess is that you #define some macro that messes-up Boost.Math code. Maybe something like #define M ......
UPDATE: It turns out that my guess was correct. Take a look at MedLDAc/MEDsLDAc/cokus.h file:
#define M (397) // a period parameter
The immediate workaround is to move #include <boost/math/special_functions/gamma.hpp> line in MedLDA.cpp to be the first include, after StdAfx.h, so that the above macro wouldn't affect the templates declared in gamma.hpp.
P.S. Defining one-letter macros is a really, really bad idea.