errors compile any programs including your tutorials

I am recieving this error message when trying to compile and run any programs.


">MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
1>C:\Users\Adam Marshall\Documents\Visual Studio 2010\Projects\no\Debug\no.exe : fatal error LNK1120: 1 unresolved externals"

I have Windows 7 operating System and I am using Visual Studio professional 2010. What do I need to to do to get this to work? I am doing some school homework assignments.

This is my code I am using.

#include <iostream>
#include <cmath>

using namespace std;

int main()
{
//declare variables for miles and kilometers
double mi, km, x1;

// compute mile to kilometer conversions
km = 1.6093440 * mi;
mi = 354.5

//output
cout << "The conversion from miles to kilometers is" << km << endl;

return 0;
}

Thanks,
Adam
Errr... what project template did you use for this? If an empty C++ project template with that one C++ file doesn't work, I'd reinstall MS VC++.

-Albatross
Last edited on
or downgrade to XP.
i used win32 console application and the C++ file with the ext. .cpp.
Try a blank project. Not a console application (although that seems logical), but start from scratch, create a new C++ file for your empty project, write your code, and try again. If that doesn't work... reinstall. ;)

-Albatross
or downgrade to XP.
Windows XP <33333

blank project or reinstall, like they said. :)
closed account (D80DSL3A)
I see a bug. This:
1
2
km = 1.6093440 * mi;
mi = 354.5 // missing ';' here is a syntax error 

Should be
1
2
mi = 354.5;
km = 1.6093440 * mi;

This probably has nothing to do with failure to recognize main() though.
Windows XP <33333

Ubuntu 10.04 LTS <33333
Ubuntu 10.04 LTS <33333
Ubuntu = best linux distribution ^^
Blech... I've been on Ubuntu for nearly 2 years now. It's given me nothing but headaches. I'm switching back to Windows soon and never looking back.

But I've ranted about it on these boards before. Maybe I can dig up that old thread....

EDIT: here it is: http://www.cplusplus.com/forum/lounge/21773/page3.html#msg117139
Last edited on
If i had to be on a Linux machine, Ubuntu would be my first pick. But if i don't have to, i think i'll stick to my 'ole faithful XP system (:
@Disch: Not Mac OS X?

-Albatross

P.S.- I liked Ubuntu 10.
@Disch: Not Mac OS X?


Apple is a trap. They like to make proprietary software that only works with proprietary hardware and vice versa. They're 10x worse than Microsoft in that regard.

If I get OSX, I'll have to get an iMac. Then I'll need a special iKeyboard and iMouse or else it won't work right. Then my normal phone will suddenly stop working and I'll need to get an iPhone.

(exaggerating of course. But Apple really does seem to go out of it's way to make itself as incompatible with 3rd party companies as it possibly can)

EDIT:

And besides... the whole world uses Windows. If you go against the grain it just makes things harder when you eventually have to interact with another machine.
Last edited on
Disch wrote:
Apple really does seem to go out of it's way to make itself as incompatible with 3rd party companies as it possibly can.


So what about Fedora? Or some other GNU/Linux distro? You can run WINE on them if you need to!

That reminds me. When my Mac breaks in a few years I'll be switching to a fully open-source system that has had all its guts reworked by me.

-Albatross
Last edited on
So what about Fedora? Or some other GNU/Linux distro?


They're just as crazy as Ubuntu, IMO.

You can run WINE on them if you need to!


I suppose that's true. You could use a compatibility layer to run programs and have it work a good 70% of the time.

Or you can just use an OS that doesn't need a compatability layer to run programs natively and have it work 100% of the time.

When my Mac breaks in a few years I'll be switching to a fully open-source system that has had all its guts reworked by me.


Sounds pretty time consuming and impractical.

Personally I dont like having to pour days and days of effort into getting my computer to work.... which is probably why I don't like Linux. I want my computer to just work.

The computer is supposed to work for you, not the other way around.


But hey if it's fun for you, go for it.
Disch wrote:
They're just as crazy as Ubuntu, IMO.

*sigh* Disch, not true.
http://en.wikipedia.org/wiki/Linux_Mint

Disch also wrote:
You could use a compatibility layer to run programs and have it work a good 70% of the time. Or you can just use an OS that doesn't need a compatability layer to run programs natively and have it work 100% of the time.

And what if the OS in question sux? (Although apparently Windows 7 isn't too bad).

Finally Disch wrote:
Sounds pretty time consuming and impractical. Personally I dont like having to pour days and days of effort into getting my computer to work....

Time consuming, yes. Impractical, yes. I would not be going it to get an unstable system with potential to work, though. On the contrary, I'd take a very stable system and get it to work so much better for me.

If you think a Windows system seen and used everywhere will work for you better than an exotic system which may require maintenance from time to time but can perform incredible feats.... your choice.

EDIT: How did this topic get so quickly into OS fanboy/fangirlism?

-Albatross

Last edited on
For doing work, any *nix-like system is useful, from Ubuntu to OS X (FreeBSD based - nice!).
Topic archived. No new replies allowed.