簡體   English   中英

NEAT C ++編譯器錯誤Microsoft Visual Studio 2012

[英]NEAT C++ Compiler errors Microsoft Visual Studio 2012

我想在Microsoft Visual Studio 2012下運行以下C ++庫(從2010開始):

http://nn.cs.utexas.edu/?neat-c

我已經修復了很多編譯器錯誤,但是對於某些問題,我找不到解決方案。 編譯器錯誤是:

1>------ Build started: Project: My_Neuronal_Network, Configuration: Debug Win32 ------
1>  species.cpp
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\species.cpp(454): warning C4101: 'spin' : unreferenced local variable
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\species.cpp(433): warning C4101: 'pause' : unreferenced local variable
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\species.cpp(453): warning C4101: 'marble' : unreferenced local variable
1>  population.cpp
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\population.cpp(71): warning C4101: 'count' : unreferenced local variable
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\population.cpp(432): warning C4101: 'pause' : unreferenced local variable
1>  genome.cpp
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\genome.cpp(1777): warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\genome.cpp(1790): warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\genome.cpp(1795): warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\genome.cpp(1845): warning C4018: '<' : signed/unsigned mismatch
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\genome.cpp(1862): warning C4018: '<' : signed/unsigned mismatch
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\genome.cpp(1884): warning C4018: '<' : signed/unsigned mismatch
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\genome.cpp(1888): warning C4018: '<' : signed/unsigned mismatch
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\genome.cpp(1961): warning C4101: 'p1innov' : unreferenced local variable
1>  experiments.cpp
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(52): error C2057: expected constant expression
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(52): error C2466: cannot allocate an array of constant size 0
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(52): error C2133: 'evals' : unknown size
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(53): error C2057: expected constant expression
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(53): error C2466: cannot allocate an array of constant size 0
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(53): error C2133: 'genes' : unknown size
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(54): error C2057: expected constant expression
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(54): error C2466: cannot allocate an array of constant size 0
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(54): error C2133: 'nodes' : unknown size
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(316): error C2057: expected constant expression
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(316): error C2466: cannot allocate an array of constant size 0
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(316): error C2133: 'runs' : unknown size
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(512): error C3861: 'lrand48': identifier not found
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(513): error C3861: 'lrand48': identifier not found
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(514): error C3861: 'lrand48': identifier not found
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(515): error C3861: 'lrand48': identifier not found
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(573): warning C4305: 'initializing' : truncation from 'double' to 'const float'
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(575): warning C4305: 'initializing' : truncation from 'double' to 'const float'
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(580): warning C4305: 'initializing' : truncation from 'double' to 'const float'
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(581): warning C4305: 'initializing' : truncation from 'double' to 'const float'
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(623): error C2057: expected constant expression
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(623): error C2466: cannot allocate an array of constant size 0
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(623): error C2133: 'record' : unknown size
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(625): error C2057: expected constant expression
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(625): error C2466: cannot allocate an array of constant size 0
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(625): error C2133: 'genesrec' : unknown size
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(627): error C2057: expected constant expression
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(627): error C2466: cannot allocate an array of constant size 0
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(627): error C2133: 'nodesrec' : unknown size
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(629): error C2057: expected constant expression
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(629): error C2466: cannot allocate an array of constant size 0
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(629): error C2133: 'winnergens' : unknown size
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(692): warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\experiments.cpp(706): warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
1>  Generating Code...
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\genome.cpp(543): error C4703: potentially uninitialized local pointer variable 'bias' used
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\genome.cpp(1948): error C4703: potentially uninitialized local pointer variable 'newgene' used
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\genome.cpp(1533): error C4703: potentially uninitialized local pointer variable 'newnode' used
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\genome.cpp(1777): error C4703: potentially uninitialized local pointer variable 'nodep1' used
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\genome.cpp(1777): error C4703: potentially uninitialized local pointer variable 'nodep2' used
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\genome.cpp(1808): error C4703: potentially uninitialized local pointer variable 'newgene' used
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\genome.cpp(1531): error C4703: potentially uninitialized local pointer variable 'newgene1' used
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\genome.cpp(1532): error C4703: potentially uninitialized local pointer variable 'newgene2' used
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\genome.cpp(2500): error C4703: potentially uninitialized local pointer variable 'chosengene' used
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\genome.cpp(2151): error C4703: potentially uninitialized local pointer variable 'chosengene' used
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\genome.cpp(2794): error C4703: potentially uninitialized local pointer variable 'chosengene' used
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\population.cpp(90): error C4703: potentially uninitialized local pointer variable 'new_genome' used
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\population.cpp(289): error C4703: potentially uninitialized local pointer variable 'new_genome' used
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\population.cpp(546): error C4703: potentially uninitialized local pointer variable 'best_species' used
1>c:\users\sebi\desktop\neuroevolution\neat.1.2.1\neat.1.2.1\species.cpp(89): error C4703: potentially uninitialized local pointer variable 'thechamp' used
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

在neat.cpp中,定義了以下內容:

%neat.cpp
...
int NEAT::num_runs = 1;
...

然后,第一個錯誤發生在:

%experiments.cpp
 int evals[NEAT::num_runs];  //Hold records for each run 

因此,該值不是恆定的。 如果我使用const int NEAT :: num_runs = 1,我什么也不會改變。

有人使用過這個庫並且能夠在Visual Studio中運行它嗎?

最好的問候塞比

基本錯誤

error C4703: potentially uninitialized local pointer variable

只需使用NULL初始化變量即可解決此錯誤。 但是實際上這不是錯誤,它是警告,可能在項目設置中已關閉。

錯誤發生在genome.cpp, population.cpp, species.cpp

因此,C4703僅是NEAT實現中必不可少的錯誤,這意味着它可以使用Visual C ++輕松編譯。

使用NEAT解決極平衡任務時會發生其他錯誤。 它們可能僅被視為用法NEAT的示例。

有人使用過這個庫並且能夠在Visual Studio中運行它嗎?

我已經將NEAT提取到靜態鏈接庫中,該庫可以在其他Visual Studio項目中使用。 解決方案中還有第二個項目,例如用法NEAT.lib

你可以在這里檢查我的解決方案

不是本質錯誤

error C3861: 'lrand48': identifier not found

只需在VisualC ++中使用rand()。

error C2133: 'evals' : unknown size

int evals[NEAT::num_runs]; -僅當NEAT::num_runsconst才可以在Visual C ++中使用它。 編譯器必須知道num_runs值。

int *evalsPtr = new int[NEAT::num_runs]; -在其他情況下使用此

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM