I´m kind of a noob when it comes to c++. Right now I have a project where I'm going to write text to a file; socical security number (text?) and name.
Something is wrong, because I keep getting a "Link Error"(fatal error LNK1120: 1 unresolved externals), even when I'm trying to debug a program that seems to work ok for others. I know that I have missed something, but I can't figure out what it is and I've never write to a text file before. My code look like this:
A linking error occurs when you don't have that library installed.
Your actual code must be quite different because there are numerous compilation errors here which would mean that it will fail before getting to the linking phase.
Here are some of the issues:
1. There should be a comma between teleNr and svar
2. namn is undefined
3. PersonNr is undefined
4. utfil is undefined.
I suppose that you could have those things declared in your std SDK if you have a really strange compiler. In that case you may get a linking error.
Is it possible that you've been editing the iostream, iomanip or fstream headers? If you've declared anything there, you'll have problems.
The problem now is that namn, teleNr and svar are all chars.
This means that if you write several characters for the name (namn) then it'll stick the first character in namn, the second character in teleNr and the third character in svar.
Solution
Make namn a std::string and teleNr an int.