Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error during build #295

Open
manumastro opened this issue Jan 11, 2024 · 6 comments
Open

Error during build #295

manumastro opened this issue Jan 11, 2024 · 6 comments

Comments

@manumastro
Copy link

hi, I am trying to build the library but I always run into the same error.
i have tried with both qt creator and visual studio as suggested on the website but to no avail.
I really want to start using this library but I am probably doing something wrong, I am new to c++.
Cattura

@manumastro
Copy link
Author

I will add that I am using the latest version cloned from the master

@shleym2000
Copy link
Contributor

Could be a version of C++ you use in your compiling environment.

You are passing std:wstring object to open() command. But the signature of this command requires char pointer in C++ 98:
void open (const char* filename, ios_base::openmode mode = ios_base::in);
In C++11 there are 2 possibilities and you really need the second one to kick in:

void open (const char* filename, ios_base::openmode mode = ios_base::in); void open (const string& filename, ios_base::openmode mode = ios_base::in);
It might work if you would set the compiling code standard from default to C++11 or C++14.

@manumastro
Copy link
Author

Okay, thank you
I tried to set the C++ version to 11 in opennn.pro file since i'm using qt creator but with no success.
I'll try to do this in visual studio and i'll let you know

@manumastro
Copy link
Author

Could be a version of C++ you use in your compiling environment.

You are passing std:wstring object to open() command. But the signature of this command requires char pointer in C++ 98: void open (const char* filename, ios_base::openmode mode = ios_base::in); In C++11 there are 2 possibilities and you really need the second one to kick in:

void open (const char* filename, ios_base::openmode mode = ios_base::in); void open (const string& filename, ios_base::openmode mode = ios_base::in); It might work if you would set the compiling code standard from default to C++11 or C++14.

Hi, i tried compiling setting the code standard to C++11 and C++14, but with no success, i get other errors, can you guys please tell me the environment are you using to compile the project?
Thank you in advance!

@Haasrobertgmxnet
Copy link

I have done the follwing steps (x64 and Visual Studio 2022 Community and Windows 11):

  1. Download opennn-6.0.3.zip from OpenNN's Github page.
  2. Extract opennn-6.0.3.zip into a folder opennn (or opennn-6.0.3).
  3. Change to this opennn folder.
  4. Do cmake . in a terminal or Powershell window.
  5. Open the solution opennn.sln in Visual Studio (in my case VS Community 2022).
  6. Select opennn as the start project ("Als Startprojekt festlegen").
  7. Right mouse-click on on the opennn project to open "Properties (Eigenschaften)" in the context menu. The Project Properties Window will open.
  8. In the Project Properties Window you can select "All Configrations (Alle Konfigurationen)" in the drop-down list in the top-left region of the window. But "Release" configuration will work, too.
  9. In the Project Properties Window select "C/C++ All Options (Alle Optionen)" on the left side.
  10. In C/C++ All Options look for "C++ Version/Standard (C++ Sprachstandard)" and set it to "ISO C++ 14 [...] (/std:c++14)" or "ISO C++ 17 [...] (/std:c++17)" to set it to C++ 14 or C++ 17 std. C++ 17 std will avoid the annoying STL 4038 warning. C++ 20 will not work.
  11. In C/C++ All Options look for "Support for Open-MP (Open-MP Unterstützung)" and set it to "No" or "Disable" (/openmp-). Then, in correlations.cpp the "#pragma omp parallel for" in line 664 will no have an effect on compilation and the code in line 666 will not end up in MSVC error C3016. According to the open issues OpenMP does not work #278 and Fix "#pragma omp parallel for" Does not parallelize #287 OpenMP seems not to work, so disabling it explicitly per compiler flag /openmp- is ok, I think.
  12. In the Project Properties Window select "C/C++ Command Line (Befehlszeile)" on the left side.
  13. There in the "Additional options (Zusätzliche Optionen)" text input window you may add the /EHsc flag to avoid the C4530 warning.
  14. Right below click "Apply (Übernehmen)" and then "OK".

That's all and then do a clean and build.

@jlack1987
Copy link

Appreciate the response, but can this not just be built manually with cmake? I'd rather not have to bring visual studio or qtcreator into the mix just to build and link against a c++ library. Also I don't see any options in the cmakelists for turning off openmp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants