Dobiasd / frugally-deep

A lightweight header-only library for using Keras (TensorFlow) models in C++.
MIT License
1.07k stars 237 forks source link

Syntax error in hpp file #394

Closed cemox35 closed 1 year ago

cemox35 commented 1 year ago

Hello there,

I have a C++/SLI project in Visual Studio 2022 on Windows. I just copied and included files frugally-deep and functionplus from Installation links. I just try to build my project. However, I got a syntax error like:

Error C2988 unrecognizable template declaration/definition MPMD_CPP_Form C:...\include\fplus\fplus.hpp 7976 Error C2059 syntax error: ')' MPMD_CPP_Form C:.....\include\fplus\fplus.hpp 7976 Error C2589 '(': illegal token on right side of '::' MPMD_CPP_Form C:.....\include\fdeep\tensor.hpp 325

Thank you for your help.

Dobiasd commented 1 year ago

Hi,

have you set the required C++ standard version in the compiler settings?

FunctionalPlus needs at least /std:c++14 to work.

cemox35 commented 1 year ago

Hi, Yes, I used that version of C++. Any other suggestion @Dobiasd?

Dobiasd commented 1 year ago

Please make sure you're using the latest release of FunctionalPlus.

If the problem persists, does it also happen in a minimal example like this?

#include <fplus/fplus.hpp>
#include <iostream>

int main()
{
    std::list<std::string> things = {"same old", "same old"};
    if (fplus::all_the_same(things))
        std::cout << "All things being equal." << std::endl;
}

(no additional source files, etc.)

If this does not help to find the cause, please post the exact command used to invocate your compiler. The screen where you can find it should look something like this: https://i.imgur.com/H0W6mDe.png

cemox35 commented 1 year ago

Yes, this works when I try to run it in a cpp console application. However, I have a CPP\SLI project. I don't understand where I am wrong.

Here the link: https://imgur.com/a/otA4YMy

This is the my command line

/ifcOutput "Debug\" /GS /analyze- /W3 /Zc:wchar_t /I"C:\Users\Cemoca\source\repos\cemox35\MPMD_CPP_Form\include" /I"C:\Users\Mert\source\repos\MPMD_CPP_Form\include" /I"C:\Users\Cem Ayar\source\repos\MPMD_CPP_Form\include" /Zi /Od /sdl- /Fd"Debug\vc143.pdb" /Zc:inline /fp:precise /D "WIN32" /D "_DEBUG" /D "_MBCS" /errorReport:prompt /WX- /Zc:forScope /Oy- /clr /FU"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.7.2\mscorlib.dll" /FU"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.7.2\System.Data.dll" /FU"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.7.2\System.dll" /FU"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.7.2\System.Drawing.dll" /FU"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.7.2\System.Windows.Forms.dll" /FU"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.7.2\System.Xml.dll" /MDd /FC /Fa"Debug\" /EHa /nologo /Fo"Debug\" /Fp"Debug\MPMD_CPP_Form.pch" /diagnostics:column

Dobiasd commented 1 year ago

Can you please try in a new, minimal, CPP\SLI project?

cemox35 commented 1 year ago

I changed the C++ 14 to 17 and fixed some errors in windows 10 SDK header files that is converting to "byte" to "BYTE".

cemox35 commented 1 year ago

I tried the new cpp console application. I can run my model, and it worked perfectly with no errors, etc. However, I don't understand the syntax error something like that: image

I did the same thing, but the error is identifier "tensors" is undefined or namespace "deep::internal" has no member "assertion"

Dobiasd commented 1 year ago

So if I understand correctly, you wrote some C++ code using frugally-deep, which compiles and runs fine. But your IDE highlights some errors.

This looks like it's not a problem with frugally-deep but with the setup of your IDE, i.e., it is not aware of the include directory.