9 Replies - 1316 Views - Last Post: 18 May 2010 - 04:39 PM Rate Topic: -----

#1 babyhulk71  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 17-May 10

Unresolved External Error

Posted 17 May 2010 - 02:06 PM

Can someone dummy down an explanation of why I'm getting this error in my compiler. Error 2 error LNK1120: 1 unresolved externals c:\users\tony\documents\visual studio 2010\Projects\week3ilab2\Debug\week3ilab2.exe 1
This is the coding I'm running and using visual studio 2010.
#include <iostream>
using namespace std;
void mult(int x,int y)
{
int i,j;
        cout<< "X";
        for (i=x;i<=y;i++)
                cout <<" "<<i;
        cout << endl;
        for (i=x;i<=y;i++){
                  cout<<i<<" ";
                  for (j=x;j<=y;j++) 
                         cout<<i*j<<" ";
          cout << "\n";
          }
}
int main()
{
int x,y;
cin>>x>>y;
if (x<y)
mult(x,y);
else 
mult (y,x);
return 0;
}


Admin Edit: Please use code tags when posting your code. Code tags are used like so => :code:

Thanks,
PsychoCoder :)

Is This A Good Question/Topic? 0
  • +

Replies To: Unresolved External Error

#2 Nakor  Icon User is offline

  • Professional Lurker
  • member icon

Reputation: 444
  • View blog
  • Posts: 1,492
  • Joined: 28-April 09

Re: Unresolved External Error

Posted 17 May 2010 - 02:24 PM

Not sure why you would be getting that, I'm having no problem running the code on my machine
Was This Post Helpful? 0
  • +
  • -

#3 babyhulk71  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 17-May 10

Re: Unresolved External Error

Posted 17 May 2010 - 02:50 PM

View PostNakor, on 17 May 2010 - 01:24 PM, said:

Not sure why you would be getting that, I'm having no problem running the code on my machine

Thanks. Do you think its my compiler, should I use a later version?
Was This Post Helpful? 0
  • +
  • -

#4 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6058
  • View blog
  • Posts: 23,495
  • Joined: 23-August 08

Re: Unresolved External Error

Posted 17 May 2010 - 03:26 PM

What is the full error message, i.e., what is it saying is an unresolved external?

I mean, with Visual Studio 2010, you're more up-to-date than most. This is almost definitely NOT a compiler issue.
Was This Post Helpful? 0
  • +
  • -

#5 apw5020  Icon User is offline

  • D.I.C Addict

Reputation: 78
  • View blog
  • Posts: 666
  • Joined: 26-March 09

Re: Unresolved External Error

Posted 17 May 2010 - 08:33 PM

I get no errors when compiling on Visual Studio 2010. Are you sure you created the right type of project? i.e. Win32 Console Application
Was This Post Helpful? 0
  • +
  • -

#6 babyhulk71  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 17-May 10

Re: Unresolved External Error

Posted 18 May 2010 - 07:09 AM

View Postapw5020, on 17 May 2010 - 07:33 PM, said:

I get no errors when compiling on Visual Studio 2010. Are you sure you created the right type of project? i.e. Win32 Console Application

It must be something I'm doing wrong, Thanks guys.
Was This Post Helpful? 0
  • +
  • -

#7 Jubb  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 88
  • Joined: 06-May 09

Re: Unresolved External Error

Posted 18 May 2010 - 10:54 AM

I haven't used VS2010 yet but it might be that you removed "#include "stdafx.h"" and your project properties specify using that as a precompiled header. That's the default setting in VS2008, and I know many people have made that mistake before.
Was This Post Helpful? 0
  • +
  • -

#8 KYA  Icon User is online

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3101
  • View blog
  • Posts: 19,141
  • Joined: 14-September 07

Re: Unresolved External Error

Posted 18 May 2010 - 11:03 AM

View Postbabyhulk71, on 18 May 2010 - 07:09 AM, said:

View Postapw5020, on 17 May 2010 - 07:33 PM, said:

I get no errors when compiling on Visual Studio 2010. Are you sure you created the right type of project? i.e. Win32 Console Application

It must be something I'm doing wrong, Thanks guys.



We could tell you exactly what it is if you'd post the exact error as requested.
Was This Post Helpful? 0
  • +
  • -

#9 babyhulk71  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 17-May 10

Re: Unresolved External Error

Posted 18 May 2010 - 04:37 PM

View PostKYA, on 18 May 2010 - 10:03 AM, said:

View Postbabyhulk71, on 18 May 2010 - 07:09 AM, said:

View Postapw5020, on 17 May 2010 - 07:33 PM, said:

I get no errors when compiling on Visual Studio 2010. Are you sure you created the right type of project? i.e. Win32 Console Application

It must be something I'm doing wrong, Thanks guys.



We could tell you exactly what it is if you'd post the exact error as requested.


I get these two errors.

1) Error 1 error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup C:\Users\Tony\documents\visual studio 2010\Projects\week3ilab3\week3ilab3\MSVCRTD.lib(crtexew.obj)

2)Error 2 error LNK1120: 1 unresolved externals C:\Users\Tony\documents\visual studio 2010\Projects\week3ilab3\Debug\week3ilab3.exe
Was This Post Helpful? 0
  • +
  • -

#10 Oler1s  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1395
  • View blog
  • Posts: 3,884
  • Joined: 04-June 09

Re: Unresolved External Error

Posted 18 May 2010 - 04:39 PM

That error is precisely because you specified your project was a Win32 GUI project, not a console project. This is what apw5020 guessed at earlier.

In the future, remember to copy-paste errors completely, so no guessing is required.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1