PhAB == Visual C++ ??

Hi,

I work with Microsoft Visual C++ and I would like to know if phab is the
equivalent software for QNX?
I hear about GCC but when I installed the C++ packages with the package
installer, I only see phab and no gcc…

What do I need to work like with Visual C++ ?
Is Phab the right software?
If yes, where do I have to write the C++ codes???
The only windows I could access was a terminal window… (Application →
build+run → new…)
And, if I have to use this terminal window, how do I save what I just
wrote??

Thanks a lot for any help and sorry for my english…

STARN

arno stoum wrote:

Hi,

I work with Microsoft Visual C++ and I would like to know if phab is the
equivalent software for QNX?

Eclipse is the equivalent of VC++, but is not released yet. PhAB would
be closest to Visual Basic (but with ‘C’ instead of basic, as the
language) if you are into MS analogies.


I hear about GCC but when I installed the C++ packages with the package
installer, I only see phab and no gcc…

What do I need to work like with Visual C++ ?

Again, Eclipse, once it is released.


Is Phab the right software?

I happen to think that if you want to program a GUI you are better off
with PhAB than Eclipse (just as I would also believe that you would be
better off with Visual Basic than Visual C++ if you are doing a GUI - if
only you didn’t have to write in basic). If you are not creating a GUI,
then of course, Eclipse is the better choice.


If yes, where do I have to write the C++ codes???

Using C++ with PhAB is pretty much a lost cause (you can do great things
with plain old C code though - and it is small and fast to boot).


Rennie

I don’t know about that. I’ve done some pretty sophisticated things with
PhAB and classes. You just need to write C cover functions that call C++
methods by faking this.

“Rennie Allen” <rallen@csical.com> wrote in message
news:3CD183E7.2070404@csical.com

Using C++ with PhAB is pretty much a lost cause (you can do great things
with plain old C code though - and it is small and fast to boot).

Rennie

In fact, I just need to write this code somewhere, compile, link and see if
it goes faster than with windows NT and if it is more stable…
It’s possible with PhAB to write this somewhere?


SOCKADDR_IN addr_Dest;
SOCKET sock_Send;
char szMessage[256]=“olaaaaaaaa”,
szDestIP[20]=“192.168.0.1”;;
short destport=4000;


//-- Create UDP socket
if ((sock_Send = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
AfxMessageBox(“Error: socket() failed.”);

//-- Fill in target addr
memset((char *) &addr_Dest, 0, sizeof(addr_Dest));
addr_Dest.sin_family = AF_INET;
addr_Dest.sin_addr.s_addr = inet_addr(szDestIP);
addr_Dest.sin_port = htons(4000);

//-- Send it

for(int i=0, i<100000,i++)
{
if (sendto(sock_Send, szMessage, 256, 0, (sockaddr*)&addr_Dest,
sizeof(addr_Dest)) == SOCKET_ERROR)
AfxMessageBox(“Error: sendto() failed.”);
}
closesocket(sock_Send);
}


STARN

arno stoum wrote:

In fact, I just need to write this code somewhere, compile, link and see if
it goes faster than with windows NT and if it is more stable…
It’s possible with PhAB to write this somewhere?


SOCKADDR_IN addr_Dest;
SOCKET sock_Send;
char szMessage[256]=“olaaaaaaaa”,
szDestIP[20]=“192.168.0.1”;;
short destport=4000;


//-- Create UDP socket
if ((sock_Send = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
AfxMessageBox(“Error: socket() failed.”);

//-- Fill in target addr
memset((char *) &addr_Dest, 0, sizeof(addr_Dest));
addr_Dest.sin_family = AF_INET;
addr_Dest.sin_addr.s_addr = inet_addr(szDestIP);
addr_Dest.sin_port = htons(4000);

//-- Send it

for(int i=0, i<100000,i++)
{
if (sendto(sock_Send, szMessage, 256, 0, (sockaddr*)&addr_Dest,
sizeof(addr_Dest)) == SOCKET_ERROR)
AfxMessageBox(“Error: sendto() failed.”);
}
closesocket(sock_Send);
}

Well, for this you don’t need either Eclipse or PhAB.

$ qcc -o foo -lsocket foo.c


… should do the trick (assuming your code is in foo.c).


Rennie

Heeeeeeee, glups…

$ qcc -o foo -lsocket foo.c

I’m really sorry but could you be more explixcit?
Where does that come from ???
Sorry to seems so stupid but the only thing I recognize in this line is:
qcc which is supposed to be for C++ but I don’t know if it’s something like
a compiler , socket (no problem with this word) and .c for C file… But the
rest:???,foo???

Is it a line for the terminal?

Starn

‘qcc’ is the compiler front end
‘-o foo’ says create the output file ‘foo’
‘-lsocket’ says include the TCP/IP socket libraries
‘foo.c’ is the long list of input file (only 1 in this case).

“arno stoum” <starn@yucom.be> wrote in message
news:aas8rv$jf5$1@inn.qnx.com

Heeeeeeee, glups…

$ qcc -o foo -lsocket foo.c

I’m really sorry but could you be more explixcit?
Where does that come from ???
Sorry to seems so stupid but the only thing I recognize in this line is:
qcc which is supposed to be for C++ but I don’t know if it’s something
like
a compiler , socket (no problem with this word) and .c for C file… But
the
rest:???,foo???

Is it a line for the terminal?

Starn

Well, we get closer ! :slight_smile:

I typed $ qcc -o foo -lsocket foo.c in the terminal

but it doesn’t find socket, I tried -|/usr/include/sys/socket (where I
found socket.h) but it doesn’t work either…
it doesn’t find $, what is it for??

There isn’t a command like qcc -help or something?
So I can stop bothering you with my newbies questions…

Thanks again,

STARN

The ‘$’ is the prompt from the shell?

“arno stoum” <starn@yucom.be> wrote in message
news:aasf34$nkd$1@inn.qnx.com

Well, we get closer ! > :slight_smile:

I typed $ qcc -o foo -lsocket foo.c in the terminal

but it doesn’t find socket, I tried -|/usr/include/sys/socket (where I
found socket.h) but it doesn’t work either…
it doesn’t find $, what is it for??

There isn’t a command like qcc -help or something?
So I can stop bothering you with my newbies questions…

Thanks again,

STARN

\

arno stoum wrote:

Well, we get closer ! > :slight_smile:

I typed $ qcc -o foo -lsocket foo.c in the terminal

but it doesn’t find socket, I tried -|/usr/include/sys/socket (where I
found socket.h) but it doesn’t work either…

The problem is probably in your source code. Do you

#include <sys/socket.h>

or

#include <socket.h> ?

Only the first form is correct.

it doesn’t find $, what is it for??

$ is the command line prompt (you shouldn’t have a ‘#’ because you
should never work as root).

There isn’t a command like qcc -help or something?
So I can stop bothering you with my newbies questions…

There are entire books on the subject of programming with gcc, for
instance: http://www.oreilly.com/catalog/prognu/

There is also on-line help within QNX (under the helpviewer) that
details the qcc driver (which is qnx specific).

on top of that there is the QNX “use” command (i.e. “use qcc”).

Rennie

Ok, I thaught the way to define socket was -|socket and I didin’t need to
define it in the C file…

Just one last thing, how do I create a new user?
I didn’t know what root was and I didn’t see anything to change of user…

Thanks for giving me some of your time :slight_smile:

Starn

Look at the documentation for the ‘passwd’ utility.

“arno stoum” <starn@yucom.be> wrote in message
news:aasj2p$qao$1@inn.qnx.com

Ok, I thaught the way to define socket was -|socket and I didin’t need to
define it in the C file…

Just one last thing, how do I create a new user?
I didn’t know what root was and I didn’t see anything to change of user…

Thanks for giving me some of your time > :slight_smile:

Starn

Thanks Bill,

I don’t know where you’re from but for me, it’s 3 AM so I think I’m going to
sleep,

Bye, and thanks again,

Starn

look under “passwd” in helpviewer

Just one last thing, how do I create a new user?
I didn’t know what root was and I didn’t see anything to change of user…


What we imagine to be order is only the prevailing form of chaos

Nicholas S. Hillier BE (mech, hons I) GradIEAust
Undertaking a PhD with sponsorship by the Co-operative Research
Centre for Mining Technology and Equipment (CMTE)
Graduate from the University of Queensland.