Dobiasd / frugally-deep

A lightweight header-only library for using Keras (TensorFlow) models in C++.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use VS to generate dynamic link library error

BraveZFLin opened this issue · comments

If the frugally-deep library is included in the file that generates the dynamic link library, it will prompt that the file content is wrong.
The configuration of project has involve the additional include directiories.
IDE: VS2022

A.cpp
#include <fdeep/fdeep.hpp>
#include “A.h”

void XX()
{}

A.h
#ifdef A_API_EXPORTS
#define A_API __declspec(dllexport)
#else
#define A_API __declspec(dllimport)
#endif

extern "C" A_API void XX();

To make sure I understand correctly (despite the formatting noise), you have the following two files

A.cpp:

#include <fdeep/fdeep.hpp>
#include “A.h”

void XX()
{}

and

A.h:

#ifdef A_API_EXPORTS
#define A_API __declspec(dllexport)
#else
#define A_API __declspec(dllimport)
#endif

extern "C" A_API void XX();

and you use Visual Studio 2022 to create a .dll file from A.cpp.

When you remove #include <fdeep/fdeep.hpp> from A.cpp, things work fine, but when it's there, you get an error.

Correct?

If yes, please let me know the exact error, to help me help you. 🙂

yes, the picture is show the error

image
image

this picture show remove #include<fdeep/fdeep.hpp> from A.cpp

image
image

If the picture does not display properly, you can find it from my “Popular repositories/picture"
thanks T T

Thanks. The error messages (identifier "_crt_app_type" is undefined, expected a declaration, namespace "std" has no member "mutex", expected a ')', etc.) seem somewhat weird.
I suggest trying the following things (and let me know about the results):

  • Remove everything else except fdeep. Maybe it's the interaction between something else with it.
  • Re-download frugally-deep. Maybe a part of some header file is missing or was altered in some way. (E.g., by a partial download, open-and-save in an editor with strange settings, etc.)
  • Create a non-DLL project, i.e., just a simple application (.exe), and check if including fdeep there works.

Any news?