Welcome, Guest. Please login or register.

Author Topic: Stuck with VBCC.... *HELP*  (Read 4274 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline DanieleTopic starter

  • Sr. Member
  • ****
  • Join Date: Feb 2006
  • Posts: 496
    • Show only replies by Daniele
Stuck with VBCC.... *HELP*
« on: January 10, 2014, 06:01:18 PM »
Hello!



I am trying to install VBCC and compile some piece of code, just some examples in C language.

First of all I downloaded the 3.9 NDk from Haage&Partner and saved the NDK_3.9 drawer in my Work: HD partition.

Accordingly with the instructions of the site  

http://sun.hasenbraten.de/vbcc/index.php?view=targets

I downloaded the files vbcc_bin_amigaos68k.lha and vbcc_target_m68k-amigaos.lha that are respectively the binary and the target file.

Installed firstly the bin and after the target over my Work: partition I was asked to tell the installer the path of the include files so I selected the drawer Work:NDK_3.9/include/include_h

as suggested here in the thread

http://www.amiga.org/forums/showthread.php?t=34765



Now it happens that if I try to compile a source like for example the 1st example of screen or window of the file http://aminet.net/package/dev/c/ACM

with the command

vc screen.c -o screen



I have a huge list of errors like showed above....

t_3_0.o: In "_main":

Error 21: t_3_0.o (CODE+0x8): Reference to undefined symbol _OpenLibrary.

t_3_0.o: In "l5":

Error 21: t_3_0.o (CODE+0x24): Reference to undefined symbol _OpenScreen.

t_3_0.o: In "l6":

Error 21: t_3_0.o (CODE+0x3a): Reference to undefined symbol _CloseLibrary.

t_3_0.o: In "l7":

Error 21: t_3_0.o (CODE+0x64): Reference to undefined symbol _CloseLibrary.

Error 21: t_3_0.o (CODE+0x4c): Reference to undefined symbol _Delay.

Error 21: t_3_0.o (CODE+0x58): Reference to undefined symbol _CloseScreen.

vlink failed returncode 20

vlink -bamigahunk -x -Bstatic -Cvbcc -nostdlib vlibos3:startup.o "T:t_3_0.o" -s -Rshort -Lvlibos3: -lvc -o screen failed





What do you think I should do to get the compiler doing his job correctly?



Thanks for your advice,



Daniele
« Last Edit: January 10, 2014, 06:05:48 PM by Daniele »
Amiga 1200 into a DBox Tower with PPC603e@166Mhz040 256MB Mediator PCI SX - Ide-Fix Express OS4 Classic Voodoo3 Fast Ethernet - A1200 030@40MHZ - A2000 030@25MHZ - A500 - A500+ - A600 - C64 + MMC REPLAY!!!
 

Offline Thomas

Re: Stuck with VBCC.... *HELP*
« Reply #1 on: January 10, 2014, 06:55:32 PM »
These are missing in your code:

#include
#include
#include

And if you find these, remove them:

#include
#include
#include

Offline DanieleTopic starter

  • Sr. Member
  • ****
  • Join Date: Feb 2006
  • Posts: 496
    • Show only replies by Daniele
Re: Stuck with VBCC.... *HELP*
« Reply #2 on: January 10, 2014, 09:06:51 PM »
Hello Thomas! Thanks for helping me....

Now I have much less errors and the code works!

I only get:

>    CloseLibrary( IntuitionBase );
warning 85 in line 69 of "screen.c": assignment of different pointers
>  CloseLibrary( IntuitionBase );
warning 85 in line 92 of "screen.c": assignment of different pointers

What else to change to get it work perfectly?
Amiga 1200 into a DBox Tower with PPC603e@166Mhz040 256MB Mediator PCI SX - Ide-Fix Express OS4 Classic Voodoo3 Fast Ethernet - A1200 030@40MHZ - A2000 030@25MHZ - A500 - A500+ - A600 - C64 + MMC REPLAY!!!
 

Offline Thomas

Re: Stuck with VBCC.... *HELP*
« Reply #3 on: January 10, 2014, 10:38:15 PM »
Try CloseLibrary((struct Library *)IntuitionBase);

How does the corresponding OpenLibrary look like?

Offline DanieleTopic starter

  • Sr. Member
  • ****
  • Join Date: Feb 2006
  • Posts: 496
    • Show only replies by Daniele
Re: Stuck with VBCC.... *HELP*
« Reply #4 on: January 10, 2014, 11:51:37 PM »
Quote from: Thomas;756814


How does the corresponding OpenLibrary look like?


mmmm...

                          I think it would be better to post the source code because I am a very beginner! :)
                          I am just trying to set up a modern C enviroment to start studying C language and made some exercises.
                         
Thank you very much Thomas I truly appreciate your time and effort!
                         
                          So the piece of code is...

#include

struct IntuitionBase *IntuitionBase;

struct Screen *my_screen;

struct NewScreen my_new_screen=
{
  0,          
  0,            
  320,        
  200,    
  3,    
  0,          
  1,        
  NULL,        
  CUSTOMSCREEN,
  NULL,        
  "MY SCREEN",
  NULL,    
  NULL  
};



main()
{
    IntuitionBase = (struct IntuitionBase *)
    OpenLibrary( "intuition.library", 0 );
 
  if( IntuitionBase == NULL )
    exit();  

  my_screen = (struct Screen *) OpenScreen( &my_new_screen );
 
  if(my_screen == NULL)
  {
 
    CloseLibrary( IntuitionBase );

    exit();  
  }

  Delay( 50 * 30);

  CloseScreen( my_screen );

  CloseLibrary( IntuitionBase );
 
}
« Last Edit: January 11, 2014, 12:09:27 AM by Daniele »
Amiga 1200 into a DBox Tower with PPC603e@166Mhz040 256MB Mediator PCI SX - Ide-Fix Express OS4 Classic Voodoo3 Fast Ethernet - A1200 030@40MHZ - A2000 030@25MHZ - A500 - A500+ - A600 - C64 + MMC REPLAY!!!
 

Offline Thomas

Re: Stuck with VBCC.... *HELP*
« Reply #5 on: January 11, 2014, 08:16:29 AM »
And this is how it should be:

Code: [Select]

#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/intuition.h>

struct IntuitionBase *IntuitionBase;

struct Screen *my_screen;

struct NewScreen my_new_screen=
{
0,
0,
320,
200,
3,
0,
1,
NULL,
CUSTOMSCREEN,
NULL,
&quot;MY SCREEN&quot;,
NULL,
NULL
};



int main(void)
{
IntuitionBase = (struct IntuitionBase *) OpenLibrary( &quot;intuition.library&quot;, 0 );

if( IntuitionBase == NULL )
return (RETURN_FAIL);

my_screen = (struct Screen *) OpenScreen( &my_new_screen );

if(my_screen == NULL)
{
CloseLibrary( (struct Library *) IntuitionBase );
return (RETURN_FAIL);
}

Delay( TICKS_PER_SECOND * 5); /* changed from 30 seconds to 5 seconds because I am impatient */

CloseScreen( my_screen );

CloseLibrary( (struct Library *) IntuitionBase );

return (RETURN_OK);
}

Offline DanieleTopic starter

  • Sr. Member
  • ****
  • Join Date: Feb 2006
  • Posts: 496
    • Show only replies by Daniele
Re: Stuck with VBCC.... *HELP*
« Reply #6 on: January 11, 2014, 05:00:21 PM »
Thomas thank you *very* much for your support.

I am now able to compile this sample code and see it working but ... honestly .... what I am really wondering as beginner is if "changes" would always be necessary in the examples I see on the amiga programming books.

Should I always made some fixes in order to get them compiled properly?

Is this depending by the compiler I use or what?

Let me figure out...
« Last Edit: January 11, 2014, 05:17:14 PM by Daniele »
Amiga 1200 into a DBox Tower with PPC603e@166Mhz040 256MB Mediator PCI SX - Ide-Fix Express OS4 Classic Voodoo3 Fast Ethernet - A1200 030@40MHZ - A2000 030@25MHZ - A500 - A500+ - A600 - C64 + MMC REPLAY!!!
 

Offline Thomas

Re: Stuck with VBCC.... *HELP*
« Reply #7 on: January 11, 2014, 07:02:42 PM »
The C language has evolved a bit since those books were written. Older compilers were less strict. Usually this led to bad code. Nowadays the compiler helps you to find errors easier. Older compilers more supported lazy programmers.

So yes, if an example contains

main()
{
...
}

then it probably contains many mistakes which you have to correct.