Error when compiling a C++ project on linux (makefile)?

0 like 0 dislike
Wrote a program in visual studio 2008 all kompilacja, the two files are joined.
But the challenge is to build the library .so on Linux, the makefile is trying to compile a bunch of errors.

int const GlobalVariableCountCh = 14; GlobalVariableACh int const = 6; int const GlobalVariableDCh = 8; struct Station { std::string station_name; std::string rec_dew; std::string year; }; struct InfAnalogChanel { int id; std::string chanell_id; std:: string ph; std::string ccmb; std::string UU; float a; double b; double skew; double min; double max; double Primery; double Secondary; std::string SP; }; struct InfDiscretChanel { int DN; std::string ch_id; std::string ph; std::string ccmb; int y; }; struct GeneralInf { ifone int; int nrates; int samp; int ensamp; }; void writeCfgFile (); void writeBinaryFile();

//#include "stdafx.h" #include #include #include #include #include "functions.h" using namespace std; struct Station station; void writeCfgFile(){ station.station_name="251 Strathmore kV"; station.rec_dew = "1"; station.year="2001"; ofstream file("fileConfiguration.cfg"); file< s; InfAnalogChanel a; InfAnalogChanel b;; a.chanell_id="current f";"; a.ccmb="; a.UU="A"; a.a=1.290489 E-01; a.b=0; a.skew=0; a.min=-32767; a.max=32767; a.Primery=3000.00000000; a.Secondary=1.00000000; a.SP="P";; b.chanell_id="current";"; b.ccmb="; b.UU="A"; b.a=5.139708 E-02; b.b=0; b.skew=0; b.min=-32767; b.max=32767; b.Primery=3000.00000000; b.Secondary=1.00000000; b.SP="P"; s.push_back(a); s.push_back(b); for(int i=0;i discret; InfDiscretChanel first; InfDiscretChanel sec; first.DN=1; first.ch_id = "Slave MTW";"; first.ccmb="; first.y=0; sec.DN=2; sec.ch_id = "3_3";"; sec.ccmb="; sec.y=0; discret.push_back(first); discret.push_back(sec); for(int i=0;i time; DateTime samp; DateTime endsamp; samp.dd = 24;; samp.yyyy=2017; samp.hh=10; samp.min=55; samp.sec=14.546459; endsamp.dd = 24;; endsamp.yyyy=2017; endsamp.hh=10; endsamp.min =55; endsamp.sec =14.647162; time.push_back(samp); time.push_back(endsamp); for(int i=0;i

//#include "stdafx.h" #include #include #include #include #include "functions.h" using namespace std; struct GeneralInf inf; void writeBinaryFile(){ fstream binary_file("fileConfiguration.dat",ios::out|ios::binary|ios::app); int i=0; int n=0; int timestamp =0; for (i=0; i<=inf.ensamp; i++){ n = i+1; binary_file.write((char *) &n, sizeof n); timestamp = i*1000; binary_file.write((char *) ×tamp, sizeof timestamp); // Value of analog channels short analogValue [GlobalVariableACh]; for(int i=0; i// MyDll.cpp : Defines the entry point for the console application. // //#include "stdafx.h" #include #include #include #include "functions.h" using namespace std; int main() { } makefile all: g++ main.cpp function1.cpp function2.cpp -o hello A compile-time error function1.cpp In function "void writeCfgFile()": function1.cpp:219:23: error: template argument for "template class std::allocator" uses local type "writeCfgFile():ateTime" vector time; ^ function1.cpp:219:23: error: when specifying "template class std::allocator" function1.cpp:219:23: error: invalid template argument 2 function1.cpp:219:29: error: invalid type in declaration before ";" token vector time; ^ function1.cpp:236:13: error: request element "push_back" in "time" having no class type 'int' time.push_back(samp); ^ function1.cpp:239:41: error: invalid types "int[int]" for array index file<
by | 4 views

1 Answer

0 like 0 dislike
vector time;
template argument for "template class std::allocator" uses local type

Before C++11 it was impossible to use local types in template parameters. Visual Studio you probably substitutes in the build settings of the project "to collect with the latest standard" or something like that. Under Linux, the makefile specify -std=c++11 to the compile options, it will include support for features of this standard.
( the following errors just due to the fact that we failed to correctly declare the vector).

no Declaration of "rand" in this scope

rand is declared in the header cstdlib, which you want to connect

unsigned __int16 m_bytesCount = 0;
function2.cpp:35:9: error: no Declaration "m_bytesCount" in this scope

__int16 is microperformance a way to declare the types of fixed width. Cross-platform - connect cstdint and use int16_t, etc.

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
asked May 21, 2019 by KirillConsoller
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
33,904 users