C Board  

Go Back   C Board > General Programming Boards > C++ Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 01-17-2003, 06:59 AM   #1
DockyD
Guest
 
Posts: n/a
Linking error

This compiles OK but the linking generates the following errors : -

--------------------Configuration: One - Win32 Debug--------------------
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/One.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

One.exe - 2 error(s), 0 warning(s)

Code :

#include "iostream.h"
#include "allegro.h"
int main()
{
allegro_init();
install_keyboard();
//set_gfx_mode(GFX_VGA,320,200,0,0); //Remove "//" if want to use resolution: 320x200 instead of 640x480.
set_gfx_mode(GFX_AUTODETECT,640,480,0,0);
set_pallete(desktop_pallete);
textout_centre(screen, font, "Hello, World!", SCREEN_W/2, SCREEN_H/2, 255);
readkey();
return 0;
}


Any help?
Thanks
  Reply With Quote
Old 01-17-2003, 07:20 AM   #2
Registered User
 
Join Date: Dec 2001
Posts: 70
int __cdecl main ()

or go to settings menu and set __cdecl as default
calling convetion.

enjoy.
golem is offline   Reply With Quote
Old 01-17-2003, 07:31 AM   #3
DockyD
Guest
 
Posts: n/a
Linking

The first suggestion does not seem to work.
Still get the same error message.
Not sure where to add your second suggestion (which menu).
Forgot to mention I'm a newbee and am using VC++6
Thanks
Andy
  Reply With Quote
Old 01-17-2003, 07:33 AM   #4
Registered User
 
foniks munkee's Avatar
 
Join Date: Nov 2001
Posts: 343
Code:
#include "iostream.h"
should be..
Code:
#include <iostream>
using namespace std;
foniks munkee is offline   Reply With Quote
Old 01-17-2003, 07:43 AM   #5
Registered User
 
Join Date: Sep 2002
Posts: 1,640
You forgot END_OF_MAIN(); at the end of main

Code:
int main()
{
return 0;
}
END_OF_MAIN();
Travis Dane is offline   Reply With Quote
Old 01-17-2003, 07:47 AM   #6
Registered User
 
Join Date: Dec 2001
Posts: 70
Quote:
END_OF_MAIN();
golem is offline   Reply With Quote
Old 01-17-2003, 09:32 AM   #7
DockyD
Guest
 
Posts: n/a
Now I'm getting loads of compile errors in the gfx.h header file of Allegro !!!
Oh dear !!

ompiling...
One.cpp
c:\program files\microsoft visual studio\vc98\include\allegro\gfx.h(172) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\gfx.h(172) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\gfx.h(172) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\gfx.h(172) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\gfx.h(172) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\gfx.h(172) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\draw.h(50) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\draw.h(50) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\draw.h(51) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\draw.h(51) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\inline\draw.inl(168) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\inline\draw.inl(180) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\inline\draw.inl(192) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\inline\draw.inl(192) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\inline\draw.inl(204) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\inline\draw.inl(204) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\inline\draw.inl(213) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\inline\draw.inl(222) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\inline\draw.inl(231) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\inline\draw.inl(231) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\inline\draw.inl(240) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\inline\draw.inl(240) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\fmaths.h(29) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\fmaths.h(29) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\fmaths.h(30) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\fmaths.h(30) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\fmaths.h(30) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\fmaths.h(31) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\fmaths.h(31) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\fmaths.h(32) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\fmaths.h(32) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\fmaths.h(32) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\fmaths.h(34) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\fmaths.h(35) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\fmaths.h(36) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\platform\al386vc.h(113 ) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\platform\al386vc.h(113 ) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\platform\al386vc.h(113 ) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\platform\al386vc.h(135 ) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\platform\al386vc.h(135 ) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\platform\al386vc.h(135 ) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\platform\al386vc.h(157 ) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\platform\al386vc.h(157 ) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\platform\al386vc.h(157 ) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\platform\al386vc.h(187 ) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\platform\al386vc.h(187 ) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\platform\al386vc.h(187 ) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\platform\al386vc.h(230 ) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\platform\al386vc.h(246 ) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\inline\fmaths.inl(46) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\inline\fmaths.inl(52) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\inline\fmaths.inl(148) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\inline\fmaths.inl(154) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\inline\fmaths.inl(160) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\inline\fmaths.inl(160) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\inline\fmaths.inl(166) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\inline\fmaths.inl(166) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\inline\fmaths.inl(172) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\inline\fmaths.inl(172) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\inline\fmaths.inl(183) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\inline\fmaths.inl(183) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\inline\fmaths.inl(194) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\inline\fmaths.inl(194) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\matrix.h(32) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\matrix.h(33) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\matrix.h(47) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\matrix.h(47) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\matrix.h(47) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\matrix.h(50) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\matrix.h(50) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\matrix.h(50) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\matrix.h(53) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\matrix.h(56) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\matrix.h(59) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\matrix.h(62) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\matrix.h(62) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\matrix.h(62) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\matrix.h(65) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\matrix.h(65) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\matrix.h(65) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\matrix.h(65) : error C2872: 'fixed' : ambiguous symbol
c:\program files\microsoft visual studio\vc98\include\allegro\matrix.h(65) : error C2872: 'fixed' : ambiguous symbol
etc
:\program files\microsoft visual studio\vc98\include\allegro\matrix.h(74) : fatal error C1003: error count exceeds 100; stopping compilation
Error executing cl.exe.

One.exe - 102 error(s), 0 warning(s)
  Reply With Quote
Old 01-17-2003, 09:48 AM   #8
Registered User
 
Join Date: Sep 2002
Posts: 1,640
Could you post you're entire code please?
Travis Dane is offline   Reply With Quote
Old 01-17-2003, 09:55 AM   #9
DockyD
Guest
 
Posts: n/a
This is the One.CPP file : -
#include <iostream>
using namespace std;
//#include "iostream.h"
#include "allegro.h"
int main()
//int __cdecl main ()

{
allegro_init();
install_keyboard();
//set_gfx_mode(GFX_VGA,320,200,0,0); //Remove "//" if want to use resolution: 320x200 instead of 640x480.
set_gfx_mode(GFX_AUTODETECT,640,480,0,0);
set_pallete(desktop_pallete);
textout_centre(screen, font, "Hello, World!", SCREEN_W/2, SCREEN_H/2, 255);
readkey();
return 0;
}
END_OF_MAIN();



Any help will be great. I will check the board later when I get home.
Thanks
  Reply With Quote
Old 01-17-2003, 10:33 AM   #10
Registered User
 
Join Date: Sep 2002
Posts: 1,640
Code:
int main() 
{
allegro_init();
install_keyboard(); 
set_gfx_mode(GFX_AUTODETECT,640,480,0,0);
set_pallete(desktop_pallete);
textout_centre(screen, font, "Hello, World!", SCREEN_W/2, SCREEN_H/2, 255);
readkey();
return 0;
}
END_OF_MAIN();
Try compiling this
Travis Dane is offline   Reply With Quote
Old 01-20-2003, 05:27 AM   #11
DockyD
Guest
 
Posts: n/a
I added this at the front of your code : -
#include <allegro.h>
It then compiles ok but when linking gives the following error :-

--------------------Configuration: One - Win32 Debug--------------------
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/One.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

One.exe - 2 error(s), 0 warning(s)

Any ideas here as until this is sorted I cannot do any graphics!
I assume it must be some setting in my project or VC++6 that is missing.

Thanks
Andy
  Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Beginner Needs help in Dev-C++ Korrupt Lawz C++ Programming 18 05-02-2009 12:27 PM
Post... maxorator C++ Programming 12 10-11-2005 08:39 AM
pointer to array of objects of struct undisputed007 C++ Programming 12 03-02-2004 04:49 AM
Stupid compiler errors ChrisEacrett C++ Programming 9 11-30-2003 05:44 PM
Couple C questions :) Divx C Programming 5 01-28-2003 01:10 AM


All times are GMT -6. The time now is 06:43 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22