Компиляцией С++ VS2008 проекта под Linux
У меня cpp файл с порядка 3000 строк кода, написанных для учебного проекта в VS2008 все работает и все ОК.
Но при попытке компиляции этого же файла под Linux(g++\C++) вылезает ТУЧА ошибок.
Что же я сделал: скачал Dev-C++ и попытался скомпилировать файл. Вылезли ошибки ( :( ). Я переписал "спорные" участки и он скомпилися C++.exe компилятором.
После этого компилю под Linux(С++), и все равно, туча ошибок.
Что посоветуете?
Есть ли cl.exe компилятор под Linux?
Цитата: sigmov
Что посоветуете?
Привести код, ошибки, скачать компилятор gcc,поискать в коде подключение платформозависимые заголовочники и вызов API.
Цитата: oxotnik333
Привести код, ошибки, скачать компилятор gcc,поискать в коде подключение платформозависимые заголовочники и вызов API.
А если я скачаю gcc под Винду, исключу все ошибки, то не получиться ли у меня, что Linux gcc его все равно не примет, по аналогии с (Windows C++\Linux C++) ?
И такой вопросик, про компиляторы:
Компилирую проект на cl.exe, c опциями /O2 /Ob2 /Oi /Ot /Oy /GT D "NDEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /FD /EHsc /MD /Gy /Yu
получаю файл 40 кб
Ничего аналогичного не нашел для (c++\g++ в Dev-C++) не нашел. Единственная опция -O3.
Получается файл 510 кб
И ладно бы, но еще работает в 3 раза медленне (((((
Ошибки(причем Windows C++\G++ компилил без ошибок):
Сами файлы в приложении
Код:
In file included from /usr/include/c++/4.3/cstdlib:73,
from /usr/include/c++/4.3/bits/stl_algo.h:65,
from /usr/include/c++/4.3/algorithm:67,
from LMatrix.h:8,
from main.cpp:4:
/usr/include/stdlib.h:699: error: expected unqualified-id before ‘int’
/usr/include/stdlib.h:699: error: expected `)' before ‘int’
/usr/include/stdlib.h:699: error: expected `)' before ‘int’
In file included from /usr/include/c++/4.3/bits/stl_algo.h:65,
from /usr/include/c++/4.3/algorithm:67,
from LMatrix.h:8,
from main.cpp:4:
/usr/include/c++/4.3/cstdlib:111: error: ‘::abs’ has not been declared
In file included from main.cpp:4:
LMatrix.h: In function ‘oct::CMatrix<double> oct::inv(const oct::_Matrix<double>&)’:
LMatrix.h:2422: error: call of overloaded ‘abs(double&)’ is ambiguous
/usr/include/c++/4.3/cstdlib:144: note: candidates are: long int std::abs(long int)
/usr/include/c++/4.3/cstdlib:175: note: long long int __gnu_cxx::abs(long long int)
LMatrix.h: In function ‘oct::CMatrix<T> oct::load::Load_matrix(std::ifstream&)’:
LMatrix.h:2469: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h:2469: error: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
LMatrix.h:2472: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h:2479: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h:2480: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h:2481: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h:2483: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h:2484: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h:2487: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h:2488: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h: In function ‘oct::CVector<T> oct::load::Load_vector(std::ifstream&)’:
LMatrix.h:2509: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h:2512: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h:2519: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h:2520: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h:2521: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h:2523: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h:2524: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h:2527: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h:2528: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
main.cpp: In function ‘SimProResult SimPro(oct::dMtx, int, double, bool)’:
main.cpp:145: error: call of overloaded ‘abs(double&)’ is ambiguous
/usr/include/c++/4.3/cstdlib:144: note: candidates are: long int std::abs(long int)
/usr/include/c++/4.3/cstdlib:175: note: long long int __gnu_cxx::abs(long long int)
main.cpp:178: error: call of overloaded ‘abs(double&)’ is ambiguous
/usr/include/c++/4.3/cstdlib:144: note: candidates are: long int std::abs(long int)
/usr/include/c++/4.3/cstdlib:175: note: long long int __gnu_cxx::abs(long long int)
main.cpp:270: error: call of overloaded ‘abs(double&)’ is ambiguous
/usr/include/c++/4.3/cstdlib:144: note: candidates are: long int std::abs(long int)
/usr/include/c++/4.3/cstdlib:175: note: long long int __gnu_cxx::abs(long long int)
LMatrix.h: In function ‘oct::CMatrix<T> oct::load::Load_matrix(std::ifstream&) [with T = double]’:
main.cpp:280: instantiated from here
LMatrix.h:2469: error: ‘strcmp’ was not declared in this scope
main.cpp:280: instantiated from here
LMatrix.h:2479: error: ‘strcmp’ was not declared in this scope
LMatrix.h:2480: error: ‘strcmp’ was not declared in this scope
LMatrix.h:2481: error: ‘strcmp’ was not declared in this scope
LMatrix.h:2483: error: ‘strcmp’ was not declared in this scope
LMatrix.h:2484: error: ‘strcmp’ was not declared in this scope
main.cpp:280: instantiated from here
LMatrix.h:2487: error: ‘strcmp’ was not declared in this scope
LMatrix.h:2488: error: ‘strcmp’ was not declared in this scope
LMatrix.h: In copy constructor ‘oct::_Vector<T>::_Vector(const oct::_Vector<T>&) [with T = bool]’:
LMatrix.h:522: instantiated from ‘oct::CVector<T>::CVector(const oct::CVector<T>&) [with T = bool]’
LMatrix.h:830: instantiated from here
LMatrix.h:144: error: ‘memcpy’ was not declared in this scope
LMatrix.h: In copy constructor ‘oct::_Matrix<T>::_Matrix(const oct::_Matrix<T>&) [with T = bool]’:
LMatrix.h:1501: instantiated from ‘oct::CMatrix<T>::CMatrix(const oct::CMatrix<T>&) [with T = bool]’
LMatrix.h:1864: instantiated from here
LMatrix.h:864: error: ‘memcpy’ was not declared in this scope
LMatrix.h: In copy constructor ‘oct::_Vector<T>::_Vector(const oct::_Vector<T>&) [with T = int]’:
LMatrix.h:522: instantiated from ‘oct::CVector<T>::CVector(const oct::CVector<T>&) [with T = int]’
LMatrix.h:1895: instantiated from here
LMatrix.h:144: error: ‘memcpy’ was not declared in this scope
LMatrix.h: In copy constructor ‘oct::_Vector<T>::_Vector(const oct::_Vector<T>&) [with T = double]’:
LMatrix.h:522: instantiated from ‘oct::CVector<T>::CVector(const oct::CVector<T>&) [with T = double]’
LMatrix.h:2287: instantiated from here
LMatrix.h:144: error: ‘memcpy’ was not declared in this scope
LMatrix.h: In copy constructor ‘oct::_Matrix<T>::_Matrix(const oct::_Matrix<T>&) [with T = double]’:
LMatrix.h:1501: instantiated from ‘oct::CMatrix<T>::CMatrix(const oct::CMatrix<T>&) [with T = double]’
LMatrix.h:2337: instantiated from here
LMatrix.h:864: error: ‘memcpy’ was not declared in this scope
from /usr/include/c++/4.3/bits/stl_algo.h:65,
from /usr/include/c++/4.3/algorithm:67,
from LMatrix.h:8,
from main.cpp:4:
/usr/include/stdlib.h:699: error: expected unqualified-id before ‘int’
/usr/include/stdlib.h:699: error: expected `)' before ‘int’
/usr/include/stdlib.h:699: error: expected `)' before ‘int’
In file included from /usr/include/c++/4.3/bits/stl_algo.h:65,
from /usr/include/c++/4.3/algorithm:67,
from LMatrix.h:8,
from main.cpp:4:
/usr/include/c++/4.3/cstdlib:111: error: ‘::abs’ has not been declared
In file included from main.cpp:4:
LMatrix.h: In function ‘oct::CMatrix<double> oct::inv(const oct::_Matrix<double>&)’:
LMatrix.h:2422: error: call of overloaded ‘abs(double&)’ is ambiguous
/usr/include/c++/4.3/cstdlib:144: note: candidates are: long int std::abs(long int)
/usr/include/c++/4.3/cstdlib:175: note: long long int __gnu_cxx::abs(long long int)
LMatrix.h: In function ‘oct::CMatrix<T> oct::load::Load_matrix(std::ifstream&)’:
LMatrix.h:2469: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h:2469: error: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
LMatrix.h:2472: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h:2479: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h:2480: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h:2481: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h:2483: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h:2484: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h:2487: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h:2488: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h: In function ‘oct::CVector<T> oct::load::Load_vector(std::ifstream&)’:
LMatrix.h:2509: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h:2512: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h:2519: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h:2520: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h:2521: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h:2523: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h:2524: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h:2527: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
LMatrix.h:2528: error: there are no arguments to ‘strcmp’ that depend on a template parameter, so a declaration of ‘strcmp’ must be available
main.cpp: In function ‘SimProResult SimPro(oct::dMtx, int, double, bool)’:
main.cpp:145: error: call of overloaded ‘abs(double&)’ is ambiguous
/usr/include/c++/4.3/cstdlib:144: note: candidates are: long int std::abs(long int)
/usr/include/c++/4.3/cstdlib:175: note: long long int __gnu_cxx::abs(long long int)
main.cpp:178: error: call of overloaded ‘abs(double&)’ is ambiguous
/usr/include/c++/4.3/cstdlib:144: note: candidates are: long int std::abs(long int)
/usr/include/c++/4.3/cstdlib:175: note: long long int __gnu_cxx::abs(long long int)
main.cpp:270: error: call of overloaded ‘abs(double&)’ is ambiguous
/usr/include/c++/4.3/cstdlib:144: note: candidates are: long int std::abs(long int)
/usr/include/c++/4.3/cstdlib:175: note: long long int __gnu_cxx::abs(long long int)
LMatrix.h: In function ‘oct::CMatrix<T> oct::load::Load_matrix(std::ifstream&) [with T = double]’:
main.cpp:280: instantiated from here
LMatrix.h:2469: error: ‘strcmp’ was not declared in this scope
main.cpp:280: instantiated from here
LMatrix.h:2479: error: ‘strcmp’ was not declared in this scope
LMatrix.h:2480: error: ‘strcmp’ was not declared in this scope
LMatrix.h:2481: error: ‘strcmp’ was not declared in this scope
LMatrix.h:2483: error: ‘strcmp’ was not declared in this scope
LMatrix.h:2484: error: ‘strcmp’ was not declared in this scope
main.cpp:280: instantiated from here
LMatrix.h:2487: error: ‘strcmp’ was not declared in this scope
LMatrix.h:2488: error: ‘strcmp’ was not declared in this scope
LMatrix.h: In copy constructor ‘oct::_Vector<T>::_Vector(const oct::_Vector<T>&) [with T = bool]’:
LMatrix.h:522: instantiated from ‘oct::CVector<T>::CVector(const oct::CVector<T>&) [with T = bool]’
LMatrix.h:830: instantiated from here
LMatrix.h:144: error: ‘memcpy’ was not declared in this scope
LMatrix.h: In copy constructor ‘oct::_Matrix<T>::_Matrix(const oct::_Matrix<T>&) [with T = bool]’:
LMatrix.h:1501: instantiated from ‘oct::CMatrix<T>::CMatrix(const oct::CMatrix<T>&) [with T = bool]’
LMatrix.h:1864: instantiated from here
LMatrix.h:864: error: ‘memcpy’ was not declared in this scope
LMatrix.h: In copy constructor ‘oct::_Vector<T>::_Vector(const oct::_Vector<T>&) [with T = int]’:
LMatrix.h:522: instantiated from ‘oct::CVector<T>::CVector(const oct::CVector<T>&) [with T = int]’
LMatrix.h:1895: instantiated from here
LMatrix.h:144: error: ‘memcpy’ was not declared in this scope
LMatrix.h: In copy constructor ‘oct::_Vector<T>::_Vector(const oct::_Vector<T>&) [with T = double]’:
LMatrix.h:522: instantiated from ‘oct::CVector<T>::CVector(const oct::CVector<T>&) [with T = double]’
LMatrix.h:2287: instantiated from here
LMatrix.h:144: error: ‘memcpy’ was not declared in this scope
LMatrix.h: In copy constructor ‘oct::_Matrix<T>::_Matrix(const oct::_Matrix<T>&) [with T = double]’:
LMatrix.h:1501: instantiated from ‘oct::CMatrix<T>::CMatrix(const oct::CMatrix<T>&) [with T = double]’
LMatrix.h:2337: instantiated from here
LMatrix.h:864: error: ‘memcpy’ was not declared in this scope
Сами файлы: