News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

error msg?

Started by shankle, June 26, 2012, 12:49:14 AM

Previous topic - Next topic

Ghandi

It all comes back to not having the necessary header files included, if a data type is used (ie: struct) then the header file which declares it is needed. Otherwise any reference to the type will flag an error, whether it be the type itself or declaring an instance of it/accessing an instant of it.

It's been the same for every language/tool i've coded with, i could be wrong but i don't think it would be any different for GoAsm would it?

HR,
Ghandi

satpro

shankle,
Reading through your posts again it occurred to me that you might be having problems with the header files because of a directory issue.  When I first set up the files on my computer nothing would work right.  It turned out I was in the wrong directory to pull the headers.  Then I added something like this in a .bat file:

cls
set INCLUDE=P:\GoAsm\Includes
GoAsm /l /b /c "dd.asm"
GoLink "dd.obj"

The "set" line fixed the problem.  But disregard the "P:\GoAsm\Includes" part.  Use your include directory instead.  "cls" just clears the console so you know where you're at while compiling.

shankle

Thanks guys for all your efforts to help me.

All of the header files from Mr. Hansen's site are on my puter as follows:
     GoAsm(g:) \include
I made a file to put the includes in:  MyProgbrs.h  #include \include\windows.h
This is what's in the Assembler program: #define LINKFILES,  #include MyProgbrs.h
The batch file is as follows: MyProgbtch.bat, set include, GoAsm(g)  /l/b/c \include\
  MyProgbrs.h MyProg.asm
Not trying to link as yet.

This is what I got when running  MyProgbtch.bat:
    Warnings....
line 299 of the include file \include\windows.h: - Could not open file:- #include
  "windef.h"
Line 303 of the include file \include\windows.h:- Must declare a section first -
Use DATA SECTION ["name"}, CODE SECTION ["name"] or CONST SECTION
["name'] or just DATA, CODE or CONST: .DATA, .CODE or .CONST 

dedndave

hi Jack,
what you may need to do is to set an environment variable
My Computer - Properties (or Control Panel - System icon)
Advanced Tab
Environment Variables button
you can create variables that will apply to the current user, or system-wide (applies to all users)

according to Edgar's notes...
QuoteYou must create an INCLUDE environment variable with the path to these header files
See "Include files - using #include and INCBIN" in the GoAsm manual for details
so you want something like
INCLUDE=G:\GoAsm\include

satpro

Can you do a copy/paste and show exactly what your set line looks like?  It's definitely the INCLUDE variable, and you can do it in the batch, which is slightly more convenient, or you can make an environment value, as stated above.  But it's definitely the INCLUDE...

Edit:  Also, once you set that variable up you won't need the "\include\" added to your #include statements.  You can just go:
#include "windows.h".  The INCLUDE variable does the subfolder work for you.

shankle

Set INCLUDE
GoAsm /l/b/c \include\MyProgbrs.h MyProg.asm
;GOlINK /unused "MyProg.obj"

yep, Think it should be:
GoAsm /l/b/c \MyProgbrs.h MyProg.asm

If I understand you all correctly the Set command should be as follows:
Set INCLUDE=G:\GoAsm\include
Guessing!!!

dedndave

correct...

if you do:
set INCLUDE
with no parameter, it simply displays the current value of that variable

if you do:
set INCLUDE=
with no parameter, it removes the variable from the environment table

satpro

shankle,
Everybody does things a bit differently, but this is sort of how I do it, using your directory structure:

The batch file:
----------------
cls
set INCLUDE=G:\GoAsm\include
GoAsm /l /b /c "MyProg.asm"
GoLink "MyProg.obj"  (sometimes you'll put a dll here, after a space, e.g.  ddraw.dll)

In the assembly file My Prog.asm:
------------------------------------
(at the top of the file--first)
#define LINKFILES
#define DONKEYLIB_H

#include "windows.h"            ;Windows defs
#include "macros.h"             ;GoAsm macros (incl. CoInvoke)
#include "ddraw.h"               ;only if you use it
#include "MyProgbrs.h"        ;your header files...
#include "some_other_assemfile.asm"

DATA SECTION
today         dd  29
tomorrow  dd  ?
nextweek   dd  today+7-30

CONST SECTION
June = 6
July = 7 (or, = June+1)

CODE SECTION
Start:
mov eax, [today]
inc eax
mov [tomorrow], eax
....


This will assume your assembly files (and your own header files, if you wish) are in the GoAsm folder, along with GoLink.exe.  The GoAsm manual describes the order in which the assembler looks for your included files, but if you put them in the GoAsm folder--you'll always be okay, although maybe a bit cluttered.  When I have stuff in weird places I'll hard-code the location:  #include "X:\movies\great movies\star trek.wav" (you wouldn't incl a wav file)
Usually, just copy that wav file to your working (let's say GoAsm) folder.  You might mess it up or delete it by accident.  Why lose the original?

In "some_other_assemfile.asm" you can put DATA, CODE, and CONST SECTIONS (and should) just like in the main file.  Keep your assembly files short and focused for organization, named for what they do. I usually limit them to one main routine (plus obvious support stuff) and that's it.   GoAsm is blisteringly fast, so don't worry AT ALL about lots of files and long compile times.  It won't happen.  If you use a tabbed multi-view editor like Notepad++ you can automate the whole thing, just like an IDE.

I just wrote this up quick.  If someone spots something wrong, please point it out.
Bert

shankle

Some success. The compile worked.
The link failed........

Here are my latest changes:
  MyProg.asm:  #define LINKFILES,  #define include.h (what I named Mr. Hansen's
   header files),  #include windows.h
  MyProgbtch.bat:  Set INCLUDE=g:\include.h,  GoAsm /l/b/c MyProg.asm, GoLink
   /unused "MyProg.obj"

Error message from GoLink: g:\>GoLink /unused "MyProg.obj" 'GoLink' is not
  recognized as an internal or external command operable program or batch file
GoLink is in the GoAsm(g) folder. MyProg is now a folder in the GoAsm folder.
Thanks guys

dedndave

in the batch file, specify the full path of GoAsm.exe and GoLink.exe

otherwise, you can add that folder to your PATH environment variable (similar to directions above)
the individual elements of the PATH variable are seperated by semicolons

you can add a folder to the PATH variable temporarily in the batch file with:
SET PATH=G:\GoAsm;%PATH%
that adds the G:\GoAsm folder to the already existing list of other folders that you have

when you modify an environment variable in a batch file, it is only valid for the life of the console window

MichaelW

Also, depending on what tools you have on your path and how many tool names are duplicated, you may have to control the order of the directories so that the correct tool will be found first.
Well Microsoft, here's another nice mess you've gotten us into.

satpro

MichaelW,
I've read your posts before and have learned from you.  Thank you.  One of the names I trust.  Please explain what you mean to shankle in ordinary terms.  I have no idea what you are saying, and only sort of at that, so this guy is brand new and really wants to learn this stuff.  Why not be clear?  Let's make this a big tent.  It wasn't too long ago I came here looking for the next step after 65816ville and you guys helped me over and over again.  Now I "get" it.  Learning GoAsm is not easy.  Masm is the popular and a "just perfectly fine" assembler, but we are here because GoAsm is literally the best assembler anyone has ever written.  Let's help shankle--and every other person with the guts to program in assembler.  And maybe, just maybe--someday let's all collaborate on a project together...

shankle,
Before I start this "whatever you call it" I want to strongly emphasize you read the GoAsm manual again.  And again.  Really.  Jeremy wrote this effing excellent assembler, and he explains it well in the manual, but his coding examples will probably seem very foreign to you.  He uses a lot of absolute references to places in memory, using numbers (e.g. +8) instead of labels, especially in the stack.  He references memory in a very simple fashion--sort of old school.  If you understand 6502, the x86 stack is about the same--but much larger in terms of its use.  256 bytes ($0100-$01FF) for a stack is nothin' today.

What Dave is saying is to create an Environment variable.  His advice is good.  If you do that you won't have to do the repetitive task of including the "set" line in your .bat file.    It's true that the "set" line is only good for the life of the console.  Well, that's the life of your programming session-normally.  Now, you can do that, and you'll be fine, but what if, and I am testament to this, you change your entire scheme between "now" and "then"?  Your programming playground may change.  You may want a clean, new place to work.    You might begin new work on drive "X."  An environment variable is in the system.  It's automated.  It doesn't change.  But---you change.
So what do you do?
This is the reason why I like the idea of a .bat file.  When you type "myprog.bat" in the command line you transfer control to a file you wrote that assembles and links your program.  It simplifies the mystical process of compiling your program into an .exe.  I gave you a working outline in an earlier post.  It's all about the current (working) directory, and GoAsm follows that premise.  Your .bat file is in the GoAsm folder, as is GoAsm itself (and your files), so the compile process works from there.

Now, why would you name a folder "include.h"?  That's a name for a file.  You are a programmer, right?  Give your folders a proper name--minus an extension.  GoAsm looks first in the current folder, and then scours the drive(s) based on a logical formula (defined in the manual) for your files.  Remember my batch file example?  Try this layout:

G:
\GoAsm
GoAsm
GoLink
your assembly files
your personal .h files
your data files
the star trek .wav file

GoAsm\Help
...all your help files, including .pdf. chm, hlp, txt, doc (and anything else that might help you while programming)

GoAsm\include
Donkey's (Mr. Hansen's) files
other stuff you accumulate, such as number conversions, etc.

Relax.  Seriously.  I went through this--it was a tough nut to crack--and I've been breathing ASM since like 1975.  I don't know--before 8-bit floating point.  You'll get this and you'll be better for it.  Get your directories in order--right now.  They're fugged up (seems to me).  Go simpler.

All assy programmers are brothers...

shankle

Hi Satpro,
Thanks for staying with me. I'm just about to give up on GoAsm.  A 15 second compile and link
has taken me several days and I am no closer than on the 1st day.
Include.H is Mr. Hansen's entire header file. Ok I can see the value of renaming it and
I will. Yes, I think I have had my directories/folders all messed up.
I like the idea of a bat file where all the goodies of one program are kept.

Of course I have become lazy using MASM32. Never have to go through all this.
I have read the manuals and understand quite a bit of it. But I need more examples
to get me started. Once over this hurdle I will test MyProg-32 bit and see if that works.
Then I have to covert it to 64-bit GoAsm. If I get that far.........

dedndave

 :biggrin:

hang in there, Jack   :t

satpro...
what Michael is talking about does not seem to apply to Jack's current dilema
but - let's say you have 2 different programs named shuffle.exe
one is in folder A and the other is in folder B
both folders are in the PATH environment variable
the operating system will use the shuffle.exe program from the folder which appears first in the PATH
UNLESS - the current folder has a program named shuffle.exe, then it would be executed
but - it is possible, that you may have to re-organize the folders in the PATH variable so that the OS finds the one you want first

a similar problem may arise because of the extension type
DOS executed BAT files before COM, before EXE
so - if you had a shuffle.bat file and a shuffle.exe file in the same folder, the batch file would execute
later operating systems had an entry in win.ini to set the order
now, there is a PATHEXT environment variable that determines the order

however, in Jack's case, the OS is simply not finding the GoLink.exe file
this can be solved by locating the executable and adding the full path to the batch command
or it can be solved by making sure that folder is in the PATH variable
another option is to copy GoLink.exe to a folder that is in the PATH   :P

shankle

State as of today 6-30-2012.
Not trying to link just compile the program.
MyProg.asm:  #define LINKFILES, #define jpsdhrs,  #include \windows.h

MyProgbtch.bat:  Set INCLUDE=g:\jpsdhrs,  Set PATH=g:\jpshdrs,  Set PATH=g:\goasm.exe,
  GoAsm /l/b/c  MyProg.asm

This is what's in the g:\GoAsm directory/folder:
  C99, GDIPlus, golink, Garejorg, gozips(all the saved GO Zips), JG, jpshdrs(Mr. Hansen's
  Header files), cmdline.txt, forhelp.txt, GoAsm.chm, goasm.exe, MyProgbtch.bat,
  MyProg.asm, cedt.cmd, cedt.exe, cedt.mac AND about 50 *.h files I moved to the
  g:\GoAsm directory/folder. Couldn't get a clean compile without doing it. There
  has to be  a better way.
Think I have the folder set up correctly. Not sure of the batch or program settings.

Here is the ERROR message I got when running MyProgbtch.bat:
Error!  The system could not make the OBJ/LST output file. OBJ file not made.