New member here, and I've some doubts *

New to FreeBASIC? Post your questions here.
AMSA
Posts: 9
Joined: Jan 27, 2011 20:35

New member here, and I've some doubts *

Post by AMSA »

Hello there people.

I'm new here in this forum, and I'm really happy to have found this forum, because, I think that has everything that I want to move forward with my future projects.

Well, I've some experience with C and C++, and now, that I'm trying to do a project based on serial communication, I decided to make an application that could be capable of getting the data or readings if you like so, from a multimeter. The multimeter in question is the Fluke 45.

So, I did some research and some google, and I found that the best way would be doing that Application in Visual Basic. Well, now you might be thinking, if this guy know something in C and C++ why is he decided to do this application in Visual Basic. That is because there some resources out there in the web and as well some projects too, and because Visual Basic is a very nice language, "easy" to learn (compared for example with Visual C++) and very popular.

But, when I decided to start doing some things in Visual Basic, I felt some difficulties in understanding "that" language, for example, where are the variables, functions, etc. For example, I didn't knew what Dim was, and why we put the "As" after the variable (Dim name As Integer) and so on.

So I thought, maybe I should start to learning the Basic language, the basis for programming after, in Visual Basic. (Like for example, I know C++, but I don't know Visual C++. But if I decided to work with Visual C++ I would have the advantage of knowing already the C++ language, and now I could start learning the part "Visual". What I mean is that I would only start to study the libraries related to the forms, and so on; I hope made myself clear. Sorry about my English)

Then I started to look for something like this forum, and I found! And the best thing is that there are a very large number of active users and lot's of information, tutorials and projects that are somehow related to the project that I want to do.

Now, what I want is that if it is possible for you guys to indicate me were to start and what to read. I see piles of information here, and some tutorials, but I really prefer you to suggest me where to start.

I've already installed the FBEdit 1.0.7.6c and the FBide.

By the way, which one is the best? I really like the FBEdit because is has that "extra help" that when we are writing, he starts to suggest what is the code that we might need) but I can't put the FBEdit compiling the simple code:

print "Hello world"
sleep

The IDE pops up an error message: C:\FreeBASIC\fbc -s console "1.bas"; What might be causing this error?

Best regards,
Charles
vdecampo
Posts: 2992
Joined: Aug 07, 2007 23:20
Location: Maryland, USA
Contact:

Post by vdecampo »

First off, welcome to FreeBASIC! We are glad to have you.

Second...

C:\FreeBASIC\fbc -s console "1.bas"

This isn't really an error message, this is FBEdit calling the FreeBASIC compiler and passing several parameters, -s console which specifies a console application, and 1.bas which is your main source code file.

Which version of FreeBASIC did you install?

Thirdly, your code example is fine and should work. Your problem may be that the IDEs are not setup correctly.

For FBEdit click Options->Compiler Version and see what you got. If that doesn't work then we need to make sure FB is installed.

-Vince
agamemnus
Posts: 1842
Joined: Jun 02, 2005 4:48

Post by agamemnus »

As for FBEdit versus FBIDE, I use FBIDE out of habit (I tell myself that it is cleaner), but FBEdit has many more features and (probably) fewer bugs -- FBIde does have some bugs with regards to the program hanging if you use the help system in a certain way.

Anyway, if you are using FBEdit, I think you need to do Make>Go. I think that's compile+run. As vdecampo points out, you only compiled it, I guess.

Don't forget to download the latest official compiler from this site and overwrite the files of whatever version FBEdit or FBIDE installed. There's an even newer version (nightly sourceforge svn) available here:
http://www.freebasic-portal.de/download ... uilds.html

http://freebasic.sourceforge.net/ has some links :P... mainly, this is important:
http://www.freebasic.net/wiki/wikka.php?wakka=FBWiki

Specifically, check out
http://www.freebasic.net/wiki/wikka.php?wakka=DocToc
There is an overall listing of stuff here.. you might be interested in "the Programmer's Guide", and "Community Tutorials" if you are newish at programming.
AMSA
Posts: 9
Joined: Jan 27, 2011 20:35

Post by AMSA »

Hello there guys.

Answering to your questions, the FbEdit IDE edition that I've is the 1.0.7.6c. I didn't "installed" the IDE. I've dowloaded the *.rar file and unrared it. The same goes to the FreeBasic Compiler, I've download it in *.rar version and unrared and put the compiler in the same directory of the IDE. Then I directed the path of the IDE compiler to the directory where I put the compiler.

So I really don't know why that error pops up.

Let me to ask you another thing. This editor that I've tried to compile my first "project" also allows to make Windows Applications, right? Like Visual Basic from Microsoft Visual Studio.

By the way, this FreeBASIC Compiler supports Object Oriented Programming?

I'll start looking to the beginners guide ;)

Best regards,
Charles
vdecampo
Posts: 2992
Joined: Aug 07, 2007 23:20
Location: Maryland, USA
Contact:

Post by vdecampo »

This editor that I've tried to compile my first "project" also allows to make Windows Applications, right?
Yes, but you will need to know the Windows API.
Like Visual Basic from Microsoft Visual Studio.
No. You can create Windows applications like you can in C.
By the way, this FreeBASIC Compiler supports Object Oriented Programming?
Yes, but not visually like VB. You can create classes with similar functionality to C and Java with the exception of Polymorphism and Inheritance.

Also, FB does not support OCX controls although there are ways to instantiate objects using certain techniques.

There are other differences which I am sure others will enumerate for me! :)

-Vince
Galeon
Posts: 563
Joined: Apr 08, 2009 5:30
Location: Philippines
Contact:

Post by Galeon »

AMSA wrote:Answering to your questions, the FbEdit IDE edition that I've is the 1.0.7.6c. I didn't "installed" the IDE. I've dowloaded the *.rar file and unrared it. The same goes to the FreeBasic Compiler, I've download it in *.rar version and unrared and put the compiler in the same directory of the IDE. Then I directed the path of the IDE compiler to the directory where I put the compiler.
From your post earlier, it seems like FbEdit uses "C:\FreeBASIC" as compiler path. Please go to Options > Path Options, set Compiler Path to $A (which means IDE's installation folder), and click OK.

If it doesn't work, make sure there is an fbc.exe file in the folder where FbEdit.exe file resides, it might have been uncompressed ("unrared") incorrectly i.e. it is in a subfolder. Set the path accordingly if it's in a subfolder.

If you're still lost, try opening a command prompt (Start > Accessories > Command Prompt), type "cd My Documents", enter, "dir /A:-D /B /S [path] > FileList.txt" (without the quotes and with [path] the absolute path where FbEdit is installed, i.e. "C:\Program Files\FbEdit", you need the quotes this time) then enter, open FileLists.txt, and show the contents so we could see what the folder looks like.

Also you may install the FreeBASIC compiler using the installer then set Compiler Path to C:\FreeBASIC (or the one you used if you changed it).
AMSA wrote:So I really don't know why that error pops up.
It shows up if a command failed to run (in this case the compilation).
kiyotewolf
Posts: 1009
Joined: Oct 11, 2008 7:42
Location: ABQ, NM
Contact:

Post by kiyotewolf »

if you want to see that PRINT statement do anything, you have to call up a SCREEN first..




SCREEN 18
PRINT "HELLO WURLD"
SLEEP
END



If you don't request something to draw on, it won't be visible.

It doesn't automatically give you a window, or fullscreen, like other languages.
vdecampo
Posts: 2992
Joined: Aug 07, 2007 23:20
Location: Maryland, USA
Contact:

Post by vdecampo »

kiyotewolf wrote:if you want to see that PRINT statement do anything, you have to call up a SCREEN first..
In his example he was using -s console which will automatically open up a console window.

-Vince
AMSA
Posts: 9
Joined: Jan 27, 2011 20:35

Post by AMSA »

Hi again fellows.

I've checked all the tips that you gave me. In matter of fact, it came up to me that maybe it would be better to redirect again the path, but this time manually like Galeon said:
C:\FreeBASIC (or the one you used if you changed it).
Because the default path was \FreeBASIC I thought that it would be always pointing to the FreeBASIC folder whatever the location of the older was.

Problem solved. Now I can compile and run the "Hello World" example ;)

vdecampo or other, can you explain this to me better:
This editor that I've tried to compile my first "project" also allows to make Windows Applications, right?


Yes, but you will need to know the Windows API.


Like Visual Basic from Microsoft Visual Studio.



No. You can create Windows applications like you can in C.
I didn't understood why I can't make the windows applications like Visual Basic. That simple thing of drag and drop (with text box, scrolls, buttons, etc) and after that, write some code to perform the "event" operations. I thought that I could, because the BASIC language is common to both, right? And the "editor version, to do that drag and drop thing" looks the same as Visual Basic.

Best regards and thanks for your answers,
Charles
fxm
Moderator
Posts: 12159
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Post by fxm »

Currently for Windows GUI, the best in my opinion is "FireFly Visual Designer for FreeBASIC" which is a visual designer with a built-in code editor very similar to the way that Visual Basic operated in the past.

http://www.freebasic.net/forum/viewtopic.php?t=15796
Galeon
Posts: 563
Joined: Apr 08, 2009 5:30
Location: Philippines
Contact:

Post by Galeon »

AMSA wrote: vdecampo or other, can you explain this to me better:
vdecampo wrote:
AMSA wrote:This editor that I've tried to compile my first "project" also allows to make Windows Applications, right?
Yes, but you will need to know the Windows API.
AMSA wrote:Like Visual Basic from Microsoft Visual Studio.

No. You can create Windows applications like you can in C.
I didn't understood why I can't make the windows applications like Visual Basic. That simple thing of drag and drop (with text box, scrolls, buttons, etc) and after that, write some code to perform the "event" operations. I thought that I could, because the BASIC language is common to both, right? And the "editor version, to do that drag and drop thing" looks the same as Visual Basic.

Best regards and thanks for your answers,
Charles
Windows API is the API used by applications to create windows in MS Windows, used in C, C++, FreeBASIC and other programming language. Based on this API, Micro$oft created Microsoft Foundation Class Library (MFC) (also used for C++), MS Visual Basic Runtime Library (Visual Basic 6 or older) and .NET Framework (used in Visual Basic .NET, 2003 or newer). Windows API is faster but harder to use. Also, using Windows API you could access lower levels of the API (those additional libraries of Micro$oft access to Windows API is limited).

Read these for more info:
http://en.wikipedia.org/wiki/Windows_API
http://en.wikipedia.org/wiki/Microsoft_ ... on_Classes
http://en.wikipedia.org/wiki/.NET_Framework

Firefly also wrapped the Windows API, that's why its quite like in .NET.

There are also some Graphical User Interface (GUI) Toolkits that are cross-platform, just like GTK+.
Linuxbob
Posts: 60
Joined: Sep 01, 2010 1:03
Location: Ohio, USA

Post by Linuxbob »

Let me to ask you another thing. This editor that I've tried to compile my first "project" also allows to make Windows Applications, right? Like Visual Basic from Microsoft Visual Studio.
Visual Basic/Visual Studio's IDE does the heavy lifting for you as far as creating the actual windows and controls. They also add new features and controls using libraries that are in the background. If you work from their IDE you never have to be exposed to the gory details. I have Visual Basic 5 and the IDE was the best in that regard.

In FB the gory details will show up in your source file, whether you write it yourself or you use an IDE. In this case FB is like writing Windows programs in C. In FB world, I am thinking the Firefly IDE is the way to go to make Windows development easier.
MichaelW
Posts: 3500
Joined: May 16, 2006 22:34
Location: USA

Post by MichaelW »

Linuxbob wrote: In FB the gory details will show up in your source file, whether you write it yourself or you use an IDE. In this case FB is like writing Windows programs in C.
In VB if you expect to do anything beyond what the developers provided for the gory details will show up anyway, and you’ll be dealing with them under adverse conditions, trying to modify the behavior of a “black box”.
Last edited by MichaelW on Jan 30, 2011 0:56, edited 1 time in total.
Linuxbob
Posts: 60
Joined: Sep 01, 2010 1:03
Location: Ohio, USA

Post by Linuxbob »

What I mean by "gory details" is the mechanics of registering Windows classes, the Wndproc() function, the coordinates and other properties of various child controls, window handles and so on. Even the ubiquitous "Hello World" looks complicated if one does the construction of the window and a "CLOSE" button. Certainly any adventure beyond the VB system into the API involves some gory details, but not to the extent that is required for 'basic' (pun intended) Windows programs without the VB system; i.e. straight C programming. In any VB program I have ever done or seen, the mechanics are out of sight, out of mind.
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Post by TJF »

AMSA wrote:This editor that I've tried to compile ...
When you did coding in C and C++ you might be interested in testing Geany. It's a free, open source and lightweight IDE for different languages (ie C, C++ and FB). Geany is cross-platform (win and LINUX) and should work out-of-the-box for FB.
AMSA wrote:... my first "project" also allows to make Windows Applications, right?
You can compile DOS, win32 and LINUX apps with FB. For win and LINUX you can code GUIs using GTK+ (like Galeon mentioned above, here's a link).

Wellcome to FB and good luck for your project!
Post Reply