Search code examples
c++external

Are these files incorrect or am I behaving incorrectly?


I am trying to use c++ files I downloaded from the internet in my visual studio 2015 project.

From here: https://www.codeproject.com/script/Articles/ViewDownloads.aspx?aid=26203 if you scroll down the files about 85% there is a zip file called galsource.zip. Underneath the zip it shows the file that is contained in the zip. I extract that to the cpp project in file explorer and try this include statement:

#include "GeneticLibrary/source/StopCriterias.h"

As far as I known, just using an include statement should not stop a project from being able to be built but when I try to run a simple hello world project with that (or any other file in that GeneticLibrary folder) import it does not build and throws dozens of errors, such as;

Severity Code Description Project File Line Suppression State Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int GeneticTesting c:\users\richard\documents\visual studio 2015\projects\genetictesting\genetictesting\geneticlibrary\source\algorithmoperations.h 73

Severity Code Description Project File Line Suppression State Error C3646 '_valueType': unknown override specifier GeneticTesting c:\users\richard\documents\visual studio 2015\projects\genetictesting\genetictesting\geneticlibrary\source\stopcriterias.h 160

Severity Code Description Project File Line Suppression State Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int GeneticTesting c:\users\richard\documents\visual studio 2015\projects\genetictesting\genetictesting\geneticlibrary\source\stopcriterias.h 160

I can't image the files I downloaded just don't work so I assume I'm doing something wrong. Any help would be really appreciated.


Solution

  • As far as I known, just using an include statement should not stop a project from being able to be built

    That is where the problem is. If you are working with a package (or a library) you can't (generally) just pick one include file. There are usually more dependencies between include files. For instance if you try to build a Windows application and just use the single windows.h file with no other supporting files - you'll get tons of errors. However I'd imagine the first errors you'd get would be about missing include files.

    Instead of "viewing" the files in the browser you should download the whole library and work with the complete source code.

    You can get the full source code from the same site, just a different link: https://www.codeproject.com/KB/recipes/geneticlibrary/galsource.zip