0

(i saw that i need to "edit my post to show how it isnt a duplicate, but actually thats what I already dedicated the first paragraph to. tnx in advance)

I have looked through some of the earlier questions about this issue, and tryed applying the knowledge from there, but I cant seem to fix it... Basicly what people are telling is that eather there is a function declaration without a defeinition (in my case there are just 4 functions, 2 constructors and 2 other functions that are already defined in the header itself), that the class header isnt included in the main.cpp (did that), or that some library function that i should have, i forgot to #include (checked that too, havent done it as far i could see, tryed both with and without including the into main.cpp, although there arent functions that use it there).

here are the errors that i got

" Error 1   error LNK2001: unresolved external symbol _mainCRTStartup   C:\Documents and Settings\Administrador\Escritorio\Lab vezba 1\test3\LINK    test3"
" Error 2   error LNK1120: 1 unresolved externals   C:\Documents and Settings\Administrador\Escritorio\Lab vezba 1\test3\Debug\test3.exe    test3"

Here is the code of all 3 of my files:

the class header:

#ifndef STUDENT_H
#define STUDENT_H
#include <iostream>
using namespace std;

class Student
{
private:
char ime[15];
char prezime[15];
int br_indexa;
float prosek;
public:
Student();
Student(char name[],char lastname[], int brind, float avg);
void show_name ()
{cout<<"Student se zove"<<ime<<" "<<prezime<<endl;}
void show_avg ()
{cout<<"Prosecna ocena iznosi: "<<prosek<<endl;}
}
#endif   

The class cpp file:

#include <iostream>
#include <string.h>
#include "Student.h"
using namespace std;
Student::Student()
{
cout<<"Neophodno je uneti ime studenta, ime je stavljeno na Uneti ime"<<endl;
ime="Uneti ime";
cout<<"Neophodno je uneti prezime studenta, prezime je postavljeno na Uneti prezime"<<endl;
prezime="Uneti prezime";
br_indexa=0;
prosek=0;
}
Student::Student(char name[],char lastname[], int brind, float avg)
{
strcpy(ime,name);
strcpy(prezime,lastname);
br_indexa=brind;
prosek=avg;
}

And finaly the main.cpp

#include <iostream>
#include <string.h> // tried with and without this
#include "Student.h"

using namespace std;

int main (void)
{
Student student1;
student1.show_name();
student1.show_avg();
Student student2 ("Marko","Krsmanovic",14712,8.1);
student2.show_name();
student2.show_avg();
return 0;
}

Really hope someone can help me here... Not sure if it matters, but I tried to compile it in Visual Studio 2010. Tnx in advance...

  • Sorry, that's the even better duplicate specifically to your question: [LNK2001: unresolved external symbol mainCRTStartup - Visual Studio 2010 - IDL project migrated from VC++](http://stackoverflow.com/questions/18500250/lnk2001-unresolved-external-symbol-maincrtstartup-visual-studio-2010-idl-pr). Please learn to research the site before asking. – πάντα ῥεῖ Dec 14 '14 at 19:46
  • Im sorry, Im new to stackoverflow, Ive been trying on various different websites in order to get the answer so I guess I didnt put enough effort in reviewing all the answers, assuming that there isnt an answer to my specific question based on first 6-7 "related" posts that Ive read. Sorry for wastingyour time and thanks a lot for the link! Regards! – Marko Krsmanovic Dec 14 '14 at 21:53

0 Answers0