[TfLite] unresolved TfLiteGPUDelegateV2Create with Visual Studio
Hi @misterBart, I'm in the process of replicating but am running into Windows installation restrictions, just letting you know I am looking into this. Thanks, I appreciate your message that you're working on it.
In the meantime I tried several things, among others I employed the Clang compiler within Visual Studio. But everything I tried still gives me the `unresolved external symbol' error. Update: the program works after removing macro `TFL_CAPI_EXPORT` (= `__declspec(dllimport)`) before the function declaration `TfLiteGpuDelegateV2Create`  and subsequently rebuild TfLite.
I never heard of `__delcapsec(dllimport)` before, and after some Googling I get the impression that it is a performance optimization for loading a dynamic library.
The first question is of course why this caused an `unresolved external` error in Windows / Visual Studio (and not in Linux with gcc). 
The second question is whether my fix by removing `TFL_CAPI_EXPORT` is a proper fix.
Do you/anybody have thoughts about this? Hi @terryheo, can you please take a look? Thanks. `TFLITE_ENABLE_GPU` isn't supported for Windows.

https://www.tensorflow.org/lite/guide/build_cmake#available_options_to_build_tensorflow_lite In my experience, the documentation often lags behind the implementation.
The GPU code contain Windows-specific code (e.g. opencl_wrapper.cc), that wouldn't make sense if Windows is not supported.
The GPU code contains a delegate for iOS' Metal, also unmentioned in the documentation.
### Issue type

Bug

### Have you reproduced the bug with TensorFlow Nightly?

Yes

### Source

source

### TensorFlow version

2.13

### Custom code

No

### OS platform and distribution

Windows 10 Pro

### Mobile device

_No response_

### Python version

3.11.4

### Bazel version

_No response_

### GCC/compiler version

Microsoft Visual Studio 2022 C++ compiler

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current behavior?

I built TfLite with `-DTFLITE_ENABLE_GPU=ON`.
I tried to test TfLite with GPU, but the minimal-working C++ example for the GPU from https://www.tensorflow.org/lite/android/delegates/gpu_native does not work under Windows 10 with Visual Studio 2022.
I receive the linker error `error LNK2001: unresolved external symbol __imp_TfLiteGpuDelegateV2Create`.
I ran `dumpbin` on `tensorflow-lite.lib` and it says a static fuction `TfLiteGPUDelegateV2Create` does exist.
I tried a different Windows 10 machine with Visual Studio 2019, but I receive the same linker error.
I got the example working under Ubuntu Linux 23.04 with gcc12 using the same build commands (except from replacing the Windows specifics with Linux specifics of course).

### Standalone code to reproduce the issue

```shell
Build commands (in Command Prompt):
git clone https://github.com/tensorflow/tensorflow tensorflow_src
mkdir tflite_release_x64
cd tflite_release_x64
cmake -G "Visual Studio 17" -A x64 -DTFLITE_ENABLE_GPU=ON ..\tensorflow_src\tensorflow\lite
cmake --build . -j 16 --config Release


C++ code (https://www.tensorflow.org/lite/android/delegates/gpu_native):
#include "tensorflow/lite/model.h"
#include "tensorflow/lite/interpreter.h"
#include "tensorflow/lite/kernels/register.h"
#include "tensorflow/lite/delegates/gpu/delegate.h"
#include <iostream>

using namespace tflite;

int main() {
	// Set up interpreter.
	auto model = FlatBufferModel::BuildFromFile("C:/Users/bartp/source/lite-model_deeplabv3_1_metadata_2.tflite");
	if (!model) return false;
	ops::builtin::BuiltinOpResolver op_resolver;
	std::unique_ptr<Interpreter> interpreter;
	InterpreterBuilder(*model, op_resolver)(&interpreter);

	auto* delegate = TfLiteGpuDelegateV2Create(/*default options=*/nullptr);

	std::cout << "Done\n";
	return 0;
}
```


### Relevant log output

```shell
1>------ Build started: Project: MweTfLite2.13Gpu, Configuration: Release x64 ------
1>Main.cpp
1>Main.obj : error LNK2001: unresolved external symbol __imp_TfLiteGpuDelegateV2Create
1>C:\Users\bartp\source\MweTfLite2.13Gpu\x64\Release\MweTfLite2.13Gpu.exe : fatal error LNK1120: 1 unresolved externals
```
