niezdefiniowane odniesienie do WinMain @ 16 (blokady kodu)
Kiedy kompiluję program secrypt.cpp, mój kompilator pokazuje błąd ”undefined reference to WinMain@16
„. mój kod jest następujący
secrypt.h:
#ifndef SECRYPT_H
#define SECRYPT_H
void jRegister();
#endif
secrypt.cpp:
#include<iostream>
#include<string>
#include<fstream>
#include<cstdlib>
#include "secrypt.h"
using namespace std;
void jRegister()
{
ofstream outRegister( "useraccount.dat", ios::out );
if ( !outRegister ) {
cerr << "File could not be opened" << endl;
exit( 1 );}
string a,b,c,d;
cout<<"enter your username :";
cin>>a;
cout<<"enter your password :";
cin>>b;
outRegister<<a<<' '<<b<<endl;
cout<<"your account has been created";
}
trial.cpp
#include<iostream>
#include "secrypt.h"
using namespace std;
int main()
{
void jRegister();
return 0;
}
Oto obraz mojego błędu:błąd obrazu
Kiedy kompiluję program trial.cpp, kompiluje i otwiera konsolę, ale nie wywołuje funkcji. Oto obraz ekranu konsoli programu trial.cpp.ekran o / p Czy ktoś może mi pomóc rozwiązać ten problem?