필터 지우기
필터 지우기

error in C++ compilation

조회 수: 4 (최근 30일)
Maher
Maher 2018년 10월 28일
편집: Walter Roberson 2018년 10월 29일
Dear all,
Can any one advise me why I have this compilation error of C++ code.
the variables seems to be not declared, while they are indeed declared in graph.hpp. Please note the C++ files are attached.
Thank you!
************************error message*************************
>> mex MexFunction.cpp
Building with 'Xcode Clang++'.
Error using mex
/Users/maherheal/Dropbox/maherphd/1UK/Last/Code_v3/MexFunction.cpp:24:24: error: C++ requires a type
specifier for all declarations
graph::Graph<char> g1(aObjects1, 4, aEdges1, 4);
^
/Users/maherheal/Dropbox/maherphd/1UK/Last/Code_v3/MexFunction.cpp:24:35: error: expected parameter
declarator
graph::Graph<char> g1(aObjects1, 4, aEdges1, 4);
^
/Users/maherheal/Dropbox/maherphd/1UK/Last/Code_v3/MexFunction.cpp:24:35: error: expected ')'
/Users/maherheal/Dropbox/maherphd/1UK/Last/Code_v3/MexFunction.cpp:24:23: note: to match this '('
graph::Graph<char> g1(aObjects1, 4, aEdges1, 4);
^
/Users/maherheal/Dropbox/maherphd/1UK/Last/Code_v3/MexFunction.cpp:25:2: error: unknown type name 'g1'
g1.computeFundamentalCycles();
^
/Users/maherheal/Dropbox/maherphd/1UK/Last/Code_v3/MexFunction.cpp:25:4: error: expected member name or
';' after declaration specifiers
g1.computeFundamentalCycles();
~~^
/Users/maherheal/Dropbox/maherphd/1UK/Last/Code_v3/MexFunction.cpp:26:2: error: unknown type name 'g1'
g1.computeAllCycles();
^
/Users/maherheal/Dropbox/maherphd/1UK/Last/Code_v3/MexFunction.cpp:26:4: error: expected member name or
';' after declaration specifiers
g1.computeAllCycles();
~~^
/Users/maherheal/Dropbox/maherphd/1UK/Last/Code_v3/MexFunction.cpp:27:2: error: unknown type name 'g1'
g1.dump(cout);
^
/Users/maherheal/Dropbox/maherphd/1UK/Last/Code_v3/MexFunction.cpp:27:4: error: expected member name or
';' after declaration specifiers
g1.dump(cout);
~~^
/Users/maherheal/Dropbox/maherphd/1UK/Last/Code_v3/MexFunction.cpp:29:2: error: unknown type name 'cout'
cout << "\n\n==================================================\n";
^
/Users/maherheal/Dropbox/maherphd/1UK/Last/Code_v3/MexFunction.cpp:29:7: error: expected member name or
';' after declaration specifiers
cout << "\n\n==================================================\n";
~~~~ ^
/Users/maherheal/Dropbox/maherphd/1UK/Last/Code_v3/MexFunction.cpp:31:18: error: array bound cannot be
deduced from an in-class initializer
char aObjects[] = { 'A', 'B', 'C', 'D', 'E', 'F' };
^
/Users/maherheal/Dropbox/maherphd/1UK/Last/Code_v3/MexFunction.cpp:32:18: error: array bound cannot be
deduced from an in-class initializer
size_t aEdges[] = { 0,1, 0,2, 1,3, 1,4, 2,5, 3,4, 3,5, 4,5 };
^
/Users/maherheal/Dropbox/maherphd/1UK/Last/Code_v3/MexFunction.cpp:34:23: error: C++ requires a type
specifier for all declarations
graph::Graph<char> g(aObjects, 6, aEdges, 8);
^
/Users/maherheal/Dropbox/maherphd/1UK/Last/Code_v3/MexFunction.cpp:34:33: error: expected parameter
declarator
graph::Graph<char> g(aObjects, 6, aEdges, 8);
^
/Users/maherheal/Dropbox/maherphd/1UK/Last/Code_v3/MexFunction.cpp:34:33: error: expected ')'
/Users/maherheal/Dropbox/maherphd/1UK/Last/Code_v3/MexFunction.cpp:34:22: note: to match this '('
graph::Graph<char> g(aObjects, 6, aEdges, 8);
^
/Users/maherheal/Dropbox/maherphd/1UK/Last/Code_v3/MexFunction.cpp:35:2: error: unknown type name 'g'
g.computeFundamentalCycles();
^
/Users/maherheal/Dropbox/maherphd/1UK/Last/Code_v3/MexFunction.cpp:35:3: error: expected member name or
';' after declaration specifiers
g.computeFundamentalCycles();
~^
/Users/maherheal/Dropbox/maherphd/1UK/Last/Code_v3/MexFunction.cpp:36:2: error: unknown type name 'g'
g.computeAllCycles();
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Troubleshooting in MATLAB Compiler SDK에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by