When using the tensorflow C++ API, the error You must define TF_LIB_GTL_ALIGNED_CHAR_ARRAY for your compiler.
The reason is as follows (see reference).
If you omit the
COMPILER_MSVC
definition, you will run into an error saying “You must defineTF_LIB_GTL_ALIGNED_CHAR_ARRAY
for your compiler.” If you omit theNOMINMAX
definition, you will run into a number of errors saying “’(‘: illegal token on right side of ‘::’”. (The reason for this is that<Windows.h>
gets included somewhere, and Windows has macros that redefinemin
andmax
. These macros are disabled withNOMINMAX
.)
Solution 1:
Add at the beginning of the code
#pragma once
#define COMPILER_MSVC
#define NOMINMAX
Solution 2:
Take vs2017 as an example: attribute Manager — > C/C + + –> preprocessor definition
Paste in the following
COMPILER_ MSVC
NOMINMAX
put things right once and for all!
Read More:
- [Solved] fatal error C1189: #error: STL1003: Unexpected compiler, expected C++ compiler
- TensorFlow tf.keras.losses .MeanSquaredError
- [Solved] Tensorflow-gpu Error: self._traceback = tf_stack.extract_stack()
- [Solved] C++ Error: terminate called after throwing an instance of ‘char const‘
- [Solved] Tensorflow/Keras Error reading weights: ValueError: axes don‘t match array
- C++ Compile Error: error: invalid conversion from ‘void*‘ to ‘char*‘ [-fpermissive]
- [Solved] error: invalid operands of types ‘const char [6]‘ and ‘const char [6]‘ to binary ‘operator+‘
- [Solved] error: taking address of temporary array av_make_error_string((char[AV_ERROR_MAX_STRING_SI…
- [Solved] Tensorflow error or keras error and tf.keras error: oom video memory is insufficient
- Cmake Error The C compiler identification is GNU 7.5.0 — The CXX compiler identification is unknown
- C++ BUG: [Error] invalid array assignment
- Cmake Setting Support C++11 This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options
- [Solved] TensorFlow Error: you must feed a value for placeholder tensor
- [Solved] Error: e0020 does not define identifier “sleep”“
- [Solved] Tensorflow-gpu 2.0.0 Run Error: ModuleNotFoundError: No module named ‘tensorflow_core.estimator‘
- Tensorflow error: attributeerror: module ‘tensorflow_ API. V1. Train ‘has no attribute’ summarywriter ‘
- [Solved] ValueError: the indices for endog and exog are not aligned
- [Solved] configure: error: C++ preprocessor “/lib/cpp” fails sanity check
- TensorFlow error: AttributeError: module ‘tensorflow_core._api.v2.train’ has no attribute ‘Optimizer‘
- TF Error: Error: TF_DENORMALIZED_QUATERNION [How to Solve]