cant open the sent exe file

my teacher cannot open the exe file of my project. It says System error and " The code execution cannot proceed because libgcc_s_seh-1.dll was not found. Reinstalling the program may fix this problem.

what could be the solution for it?
You may look where on your computer this .dll is and put it next to the .exe and provide it to your teacher.

Or

See the settings for you project and change them to static linking instead of dynamic.
how to change from dynamic to static?
What is your development environment/ide?
code blocks
it is still not working :(( im sorry im kinda new to programming so i have no any ideas in this
See your thread at
http://www.cplusplus.com/forum/beginner/276036/#msg1191176

Did putting
-static

in your linker options seriously not work?
when i run the code it gives the exe file but when i only open the exe file from the bin>debug folder it doesnt work
it doesnt work


That's not a very helpful description of the problem.

What does this code look like?
when i open the exe file from the bin>debug folder thats when the error shows up
the code looks like this

MAIN.CPP

#include <iostream>
#include <fstream>
#include <string>
#include "Students.h"

using namespace std;

int main()
{
int user = 0;
Students stdnt;

while (user != 6){
cout <<"\n\t\t\tWelcome To Student Management System.";
cout <<"\n\t\t\t=====================================";
cout <<"\n\t\t\t 1. New Student";
cout <<"\n\t\t\t 2. Search Student";
cout <<"\n\t\t\t 3. Delete Record";
cout <<"\n\t\t\t 4. Edit Record";
cout <<"\n\t\t\t 5. View Record";
cout <<"\n\t\t\t 6. Exit";
cout<<"\n\t\t\t=====================================";
cout<<"\n\t\t\t ";

cout <<"\n\t\t\t Pick a choice: ";
cin >> user;

switch(user)
{
case 1:
stdnt.newStudent();
break;

case 2:
stdnt.searchStudent();
break;

case 3:
stdnt.deleteRecord();
break;

case 4:
stdnt.editRecord();
break;

case 5:
stdnt.viewRecord();
break;

default:
user = 6;
break;
}
}
return 0;
}


STUDENTS.CPP

#include "Students.h"
#include <iostream>
#include <fstream>
#include <string>
using namespace std;

Students::Students()
{
//ctor
}

Students::~Students()
{
//dtor
}

void Students::newStudent()
{
string firstname;
string remarks;
string user;
string lastname;
int grade;
string studentNumber;
const int maxinput = 5;
int counter = 0;
ofstream record("record.txt", ios::app); //write

while(counter != 1){
cout << "\n\t\t\tEnter Student Number: 2021-";
cin >> studentNumber;

if (studentNumber.size() > maxinput){
cout << "\n\t\t\tThe maximum character input is 5.";
}
else{
counter = 1;
}
}


cout << "\n\t\t\tEnter Student's First Name: ";
cin >> firstname;

cout << "\n\t\t\tEnter Student's Last Name: ";
cin >> lastname;

cout << "\n\t\t\tEnter Student's Grade: ";
cin >> grade;

cout << "\n";
if(grade < 75){
remarks = "Failed";
}
if(grade >= 75){
remarks = "Passed";
}
record << studentNumber << ' ' << firstname << ' ' << lastname << ' ' << remarks << endl;
record.close();
}

void Students::searchStudent()
{
string firstname;
string remarks;
string user;
string lastname;
int studentNumber;
int choice;
int end1 = 0;
ifstream hanap("record.txt");
int isFound=-1;
while(end1 != 1){
cout << "\n\t\t\tStudent Number: 2021-";
cin >> choice;
while(hanap >> studentNumber >> firstname >> lastname >> remarks)
{
if (choice == studentNumber)
{
cout << "\n\t\t\tStudent Found!" << endl;
cout << "\n\t\t\tNo. |" << " Name |" << " Remarks" << endl;
cout << "\n\t\t\t=================================" << endl;
cout << "\n\t\t\t" << studentNumber << " | " << firstname << " " << lastname << " | " << remarks;
cout << "\n" << endl;
isFound=1; end1 = 1;
}else{
isFound==-1;
}
}
end1=1;
}
if (isFound==-1) {
cout << "\n\t\t\tStudent Number does not exist." << endl;
cout << "\n";
cin.clear();
}
hanap.close();
}

void Students::viewRecord()
{
string firstname;
string remarks;
string user;
string lastname;
int studentNumber;

ifstream hanap("record.txt");

while(hanap >> studentNumber >> firstname >> lastname >> remarks)
{
cout << "\n\t\t\tStudents Record!" << endl;
cout << "\n\t\t\tNo. |" << " Name |" << " Remarks" << endl;
cout << "\n\t\t\t=================================" << endl;
cout << "\n\t\t\t" << studentNumber << " | " << firstname << " " << lastname << " | " << remarks;
cout << "\n" << endl;
}
hanap.close();
}

void Students::deleteRecord()
{
string firstname;
string remarks;
string user;
string lastname;
int studentNumber;
int choice;
int grade;

cout << "\n\t\t\tStudent Number to Delete: 2021-";
cin >> choice;

ifstream d;
d.open("record.txt");
ofstream temp;
temp.open("temp.txt");
d >> studentNumber;
d >> firstname;
d >> lastname;
d >> remarks;
while(!d.eof())
{
if(studentNumber != choice)
{
temp << studentNumber << ' ' << firstname << ' ' << lastname << ' ' << remarks << endl;
}
else
{
cout << "\n\t\t\tStudent Record has been deleted." << endl;
}

d >> studentNumber >> firstname >> lastname >> remarks;
}
d.close();
temp.close();

remove("record.txt");
rename("temp.txt", "record.txt");
}

void Students::editRecord()
{
string firstname, firstNew;
string remarks, remarksNew;
string user;
string lastname, lastNew;
int studentNumber, studentNew;
int choice;
int grade, gradeNew;

cout << "\n\t\t\tStudent Number to Edit: 2021-";
cin >> choice;

ifstream e;
e.open("record.txt");
ofstream temp;
temp.open("temp.txt");
e >> studentNumber;
e >> firstname;
e >> lastname;
e >> remarks;
while(!e.eof())
{
if(studentNumber != choice)
{
temp << studentNumber << ' ' << firstname << ' ' << lastname << ' ' << remarks << endl;
}
else
{
cout << "\n\t\t\tEnter New Student Number: 2020-";
cin >> studentNew;

cout << "\n\t\t\tEnter Student's First Name: ";
cin >> firstNew;

cout << "\n\t\t\tEnter Student's Last Name: ";
cin >> lastNew;

cout << "\n\t\t\tEnter Student's Grade: ";
cin >> gradeNew;

cout << "\n";

if(grade < 75){
remarksNew = "Failed";
}
if(grade >= 75){
remarksNew = "Passed";
}
temp << studentNew << ' ' << firstNew << ' ' << lastNew << ' ' << remarksNew << endl;
}

e >> studentNumber >> firstname >> lastname >> remarks;
}
e.close();
temp.close();

remove("record.txt");
rename("temp.txt", "record.txt");
cout << "\n\t\t\tStudent's Record has been Successfully Edited." << endl;
cout << ' ' << endl;
}


STUDENTS.H

#ifndef STUDENTS_H
#define STUDENTS_H
#include <iostream>
#include <string>
#include <fstream>

using namespace std;

class Students
{
public:
Students();
virtual ~Students();

void newStudent();
void searchStudent();
void editRecord();
void deleteRecord();
void viewRecord();

protected:

private:
};

#endif // STUDENTS_H
Last edited on
Well, I compiled it at the command line with
g++ -static -o studentSystem.exe main.cpp students.cpp
and it seemed to run:
			Welcome To Student Management System.
			=====================================
			 1. New Student
			 2. Search Student
			 3. Delete Record
			 4. Edit Record
			 5. View Record
			 6. Exit
			=====================================
			 
			 Pick a choice: 1
			Enter Student Number: 2021-12345
			Enter Student's First Name: Wotsis
			Enter Student's Last Name: Name
			Enter Student's Grade: 90

			Welcome To Student Management System.
			=====================================
			 1. New Student
			 2. Search Student
			 3. Delete Record
			 4. Edit Record
			 5. View Record
			 6. Exit
			=====================================
			 
			 Pick a choice: 6



So, what do you mean by:
it doesnt work

Did it compile (presumably, yes).
Did it "run"?
Did it give the wrong answers?


when i open the exe file from the bin>debug folder thats when the error shows up
That's when what error showed up?
Did you, or did you not, link with the -static option?
Last edited on
it doesnt run when i open the exe file from the bin>debug folder because i need to pass the exe file to my teacher.
" The code execution cannot proceed because libgcc_s_seh-1.dll was not found. Reinstalling the program may fix this problem." this shows up when i try to epn the exe file from bin>debug folder


i did link the -static option but it still doesnt work
Last edited on
i did link the -static option but it still doesnt work


If it linked with the -static option then it won't be looking for a dll. By definition.

Delete that .exe file, check that you have set the -static option and try again. You might not even be looking for executable files in the correct directory.
Last edited on
it worked now. thankyou very much for saving me hahahaha <3
Topic archived. No new replies allowed.