Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Momentics IDE 4.7 build error in hello world tutorial: (19 Items)
   
Momentics IDE 4.7 build error in hello world tutorial  
I am running the Momentics IDE 4.7 tool suite on Windows XP, and I am getting an error when building the hello world 
tutorial C++ program.  

The error says

cc:Can't specify -P, -C, -E, -c or -S with -o and have multiple files
Build error occurred, build is stopped

I have no experience with QNX and just want a sample program to run to get a start with QNX and eventually be able to 
write C++ programs.

What should I do?
Re: Momentics IDE 4.7 build error in hello world tutorial  
What kind of tutorial are you using? If you create QNX C Project it should just work.
If you writing your own makefile you need to know what options to pass, I don't know what you are passing now.

On 29/11/10 08:27 PM, Nick Hayes wrote:
> I am running the Momentics IDE 4.7 tool suite on Windows XP, and I am getting an error when building the hello world 
tutorial C++ program.  
> 
> The error says
> 
> cc:Can't specify -P, -C, -E, -c or -S with -o and have multiple files
> Build error occurred, build is stopped
> 
> I have no experience with QNX and just want a sample program to run to get a start with QNX and eventually be able to 
write C++ programs.
> 
> What should I do?
> 
> 
> 
> _______________________________________________
> 
> QNX Momentics Getting Started
> http://community.qnx.com/sf/go/post76378
> 
Re: Momentics IDE 4.7 build error in hello world tutorial  
I am using the Tutorial: Creating a simple application located C/C++ Development User Guide > Getting Started> Tutorial:
 Creating a simple application

The build error happens in Step 2: Reviewing the code and building the project at sub step 3.
Re: Momentics IDE 4.7 build error in hello world tutorial  
And?
What is the question? What is the error?

On 03/12/2010 7:27 PM, Nick Hayes wrote:
> I am using the Tutorial: Creating a simple application located C/C++ Development User Guide>  Getting Started>  
Tutorial: Creating a simple application
>
> The build error happens in Step 2: Reviewing the code and building the project at sub step 3.
>
>
>
> _______________________________________________
>
> QNX Momentics Getting Started
> http://community.qnx.com/sf/go/post77216
>
Re: Momentics IDE 4.7 build error in hello world tutorial  
Sorry I did not read the whole thread. What is the full console output?
Re: Momentics IDE 4.7 build error in hello world tutorial  
This may be because of garbage in environment.
OP: can  you check your environment (output of set command in windows )
for suspicious variables like CFLAGS, CCFLAGS, MAKEFLAGS and so on.

/S.
Re: Momentics IDE 4.7 build error in hello world tutorial  
I have gotten the program to build, and the environment is empty. But now when I go to run the program in Step 3:Running
 the application substep 4.  The run button is not able to be clicked because there is a red X by the Debugger tab.  I 
have gone through all the available Debuggers in the drop down bar and all of them give me the same error message of:

 'Launching HelloWorld Debug' has encountered a problem.

Error starting process.

and in the details tab it says:

Error starting process.
Cannot run program "E:\helloworld\HelloWorld\Debug\HelloWorld": Launching failed


I think the problem has something to do with the toolchain/debugger. What do I need to do to get that setup properly in 
Windows?

I have download MSYS, mingw and the gdb file as it says in the before you get started help file.  Do I need to connect 
these to the QNX Momentics IDE 4.7 somehow?
Re: Momentics IDE 4.7 build error in hello world tutorial  
What are you trying to debug? You don't need mingw debugger unless you want to debug on windows. Momentics is for 
debugging on QNX. What project is that? What launch configuration are you using?

On 06/12/10 02:11 PM, Nick Hayes wrote:
> I have gotten the program to build, and the environment is empty. But now when I go to run the program in Step 3:
Running the application substep 4.  The run button is not able to be clicked because there is a red X by the Debugger 
tab.  I have gone through all the available Debuggers in the drop down bar and all of them give me the same error 
message of:
> 
>  'Launching HelloWorld Debug' has encountered a problem.
> 
> Error starting process.
> 
> and in the details tab it says:
> 
> Error starting process.
> Cannot run program "E:\helloworld\HelloWorld\Debug\HelloWorld": Launching failed
> 
> 
> I think the problem has something to do with the toolchain/debugger. What do I need to do to get that setup properly 
in Windows?
> 
> I have download MSYS, mingw and the gdb file as it says in the before you get started help file.  Do I need to connect
 these to the QNX Momentics IDE 4.7 somehow?
> 
> 
> 
> _______________________________________________
> 
> QNX Momentics Getting Started
> http://community.qnx.com/sf/go/post77481
> 
Re: Momentics IDE 4.7 build error in hello world tutorial  
We want it to debugg in Windows right now.  Our project is to have a plane fly some simple patterns autonomously.  Right
 now we just want to be able to write our code in Momentics and make sure it runs and compiles correctly.  We plan to 
buy a PC104 computer soon and install the QNX RTOS on it to run the code for the plane.  So I'm just asking for some 
help with getting the code to run and compile in Windows for now.
RE: Momentics IDE 4.7 build error in hello world tutorial  
Hi, Nick,

Back to your debug problem - you need to make sure the following setups are true in order to debug your program:

1) Besides the IDE 4.7, you need to have the full QNX Development Platform (SDP) installed in your Windows machine. You 
mentioned you could build your program using Momentics IDE so I assumed you have the SDP installed but just to confirm.
2) You need to ensure your program is built targeting QNX Neutrino not your host OS (Windows). If your project is a "QNX
 C Project" you already have this set. If your project is a plain "C Project" in your project build settings you need to
 select the QNX/QCC toolchain.
3) You need to have a separate machine or VM running QNX Neutrino. You need to run the same version of the SDP which is 
installed in your Windows - this is to make sure you have matching binaries (e.g. libc) between host and target for your
 debug to success.
4) In you debug launch configuration, you need to select "C/C++ QNX QConn (IP)" debug type. Especially important you can
 not select the first entry "C/C++ Application" because it will try to run your program on your Windows host and that is
 going to fail. Based on the error you got ('Launching HelloWorld Debug' has encountered a problem.  Error starting 
process.) I suspect you accidentally selected the first entry.
5) In the Debugger tab you need to select "QNX GDB Debugger" and leave the default "gdb" in the debugger command field. 
IDE debug launch will find the correct gdb to run based on your target CPU settings. Also the "GDB command set" filed 
has to be Standard Neutrino not Standard Linux or any others.
6) Leave other tabs and fields in their default settings to get your started.

HTH, please try again. It's not that difficult to build and debug a sample Hello World program.

Thanks,
Andy

-----Original Message-----
From: Nick Hayes [mailto:community-noreply@qnx.com]
Sent: Thu 09/12/2010 5:07 PM
To: momenticsgs-community
Subject: Re: Momentics IDE 4.7 build error in hello world tutorial
 
We want it to debugg in Windows right now.  Our project is to have a plane fly some simple patterns autonomously.  Right
 now we just want to be able to write our code in Momentics and make sure it runs and compiles correctly.  We plan to 
buy a PC104 computer soon and install the QNX RTOS on it to run the code for the plane.  So I'm just asking for some 
help with getting the code to run and compile in Windows for now.



_______________________________________________

QNX Momentics Getting Started
http://community.qnx.com/sf/go/post78207


Attachment: Text winmail.dat 3.79 KB
Re: RE: Momentics IDE 4.7 build error in hello world tutorial  
Thanks everybody,

I am a student at the University of Alabama and we are now on our holiday break so I will not be able to work on the 
project again until January.  When I do I will update this forum with what is going on.

Thanks again everybody,
Nick
Re: RE: Momentics IDE 4.7 build error in hello world tutorial  
We are back to working on the project, and we have now installed Windows Virtual PC 2007 on to the computer.  We have 
also uploaded QNX Neutrino onto the operating system.  How do I get the QNX Neutrino on the virtual machine to talk to 
the computer and more specifically to the QNX Momentics?  Also we have no internet connection to the computer we are 
working on.  It is not even on a network.
Re: Momentics IDE 4.7 build error in hello world tutorial  
Please read getting started guide. For vmware you can specify NAT networking which would create a virtual network 
between host of virtual device.


On 27/01/11 01:25 PM, Nick Hayes wrote:
> We are back to working on the project, and we have now installed Windows Virtual PC 2007 on to the computer.  We have 
also uploaded QNX Neutrino onto the operating system.  How do I get the QNX Neutrino on the virtual machine to talk to 
the computer and more specifically to the QNX Momentics?  Also we have no internet connection to the computer we are 
working on.  It is not even on a network.
> 
> 
> 
> _______________________________________________
> 
> QNX Momentics Getting Started
> http://community.qnx.com/sf/go/post82695
> 
Re: Momentics IDE 4.7 build error in hello world tutorial  
Here's a link to the latest version of the Quickstart Guide that Elena referred to:

  http://www.qnx.com/download/feature.html?programid=20982

Steve Reid (stever@qnx.com)
Technical Editor
QNX Software Systems
Re: RE: Momentics IDE 4.7 build error in hello world tutorial  
Hi again,

We have QNX Momentics running now, and we have been trying some simple C++ code on it.  We have been having some 
problems with getting math functions to work like pow, sqrt, sin, cos etc. We are also having some problems with reading
 in from a file and outputting to a file. We have included the <math.h> and <fstream> libraries, but when we ran the 
following code:

double ans;
double x=3.1459;
 ans=cos(x);
cout<<ans<<endl;

error messages appear that state there is a problem of "undefined reference to '_Sin' " and lists its location at line 
587 in the math.h library.

Similarly, when the following code is run: 

double ans;
ans=pow(3,5)

an error message states there is a problem of "undefined reference to 'pow' " and lists its location at the line in our 
code. 

The syntax we are familiar with using is not working correctly. If anyone could offer some sample code that runs in QNX 
Momentics that has sin, cos, pow, sqrt, and/or is able to read numbers from a text file and output numbers or text to a 
text file, that would be very helpful. 
RE: RE: Momentics IDE 4.7 build error in hello world tutorial  

> -----Message d'origine-----
> De : Nick Hayes [mailto:community-noreply@qnx.com]
> Envoyé : 3 mars 2011 11:55
> À : momenticsgs-community
> Objet : Re: RE: Momentics IDE 4.7 build error in hello world tutorial
> 
> Hi again,
> 
> We have QNX Momentics running now, and we have been trying some
> simple C++ code on it.  We have been having some problems with getting
> math functions to work like pow, sqrt, sin, cos etc. We are also having some
> problems with reading in from a file and outputting to a file. We have
> included the <math.h> and <fstream> libraries,

These are not libraries, they are header files.  For the math functions you need to add the math library.  This is 
explain in the documentation of each of tese functions.

 but when we ran the
> following code:
> 
> double ans;
> double x=3.1459;
>  ans=cos(x);
> cout<<ans<<endl;
> 
> error messages appear that state there is a problem of "undefined reference
> to '_Sin' " and lists its location at line 587 in the math.h library.

The error should come up went it's linking it not when you are running the application.

> 
> Similarly, when the following code is run:
> 
> double ans;
> ans=pow(3,5)
> 
> an error message states there is a problem of "undefined reference to 'pow'
> " and lists its location at the line in our code.
> 
> The syntax we are familiar with using is not working correctly. If anyone could
> offer some sample code that runs in QNX Momentics that has sin, cos, pow,
> sqrt, and/or is able to read numbers from a text file and output numbers or
> text to a text file, that would be very helpful.

As for reading files, you provide no descriptions of your problem.  

> 
> 
> 
> 
> _______________________________________________
> 
> QNX Momentics Getting Started
> http://community.qnx.com/sf/go/post83725
> 
Re: RE: RE: Momentics IDE 4.7 build error in hello world tutorial  
Our errors occured when we built the program, so it could not run.  And I would really appreciate it if I could get a 
sample program or code that would run in C++ in the QNX Momentics that uses math functions like sin, cos, pow, and sqrt.
  

our code has the header files included as:

#include <math.h>

does this not include the library so that we can use the math functions listed above?
RE: RE: RE: Momentics IDE 4.7 build error in hello world tutorial  
No, that simply includes the header file that contains the function
declarations. You need to link your application against the math
library; the Quickstart Guide tells you how to do that:

 
http://www.qnx.com/developers/docs/6.5.0/topic/com.qnx.doc.momentics_qui
ckstart/about.html#Compiling


Steve Reid (stever@qnx.com)
Technical Editor
QNX Software Systems 

> -----Original Message-----
> From: Nick Hayes [mailto:community-noreply@qnx.com]
> Sent: Monday, March 07, 2011 5:37 PM
> To: momenticsgs-community
> Subject: Re: RE: RE: Momentics IDE 4.7 build error in hello world
> tutorial
> 
> Our errors occured when we built the program, so it could not run.
And
> I would really appreciate it if I could get a sample program or code
> that would run in C++ in the QNX Momentics that uses math functions
> like sin, cos, pow, and sqrt.
> 
> our code has the header files included as:
> 
> #include <math.h>
> 
> does this not include the library so that we can use the math
functions
> listed above?
> 
> 
> 
> _______________________________________________
> 
> QNX Momentics Getting Started
> http://community.qnx.com/sf/go/post83800
Re: RE: RE: RE: Momentics IDE 4.7 build error in hello world tutorial  
Thanks you for the quick fix! Our math functions now work perfectly.  We are now having trouble with reading data from a
 text file and outputting data to a text file. 

Here is the sample code:

#include <cstdlib>
#include <iostream>
#include <math.h>
#include <fstream>
#include <istream>
#include <ostream>
using namespace std;

int main(int argc, char *argv[]) {
	std::cout << "Welcome to the QNX Momentics IDE" << std::endl;
	string num;
	cout<<"hello world"<<endl;
	ifstream input;
	ofstream output;
	input.open("numbers.txt");
	output.open("success.txt");
	int z;
	for(int i=0;i<6;i++){
	input>>z;
	cout<<z<<endl;
	}
	double one, two, ans;
	one = 10.0;
	two = 20.35;
	ans = one*two;
	cout<<ans<<" x"<<endl;
	output<<ans<<" victory"<<endl;
	double degree;
	degree=cos(3.1459/4);
	cout<<degree<<endl;
	ans = pow(one,two);
	cout<<ans<<" pow"<<endl;
	ans = sqrt(one);
	cout<<ans<<" sqrt"<<endl;
	output.close();
	return EXIT_SUCCESS;
}

And our file numbers.txt looks like:
1 2 5 7 8 9

And here is the console output:

Welcome to the QNX Momentics IDE
hello world
134612012
134612012
134612012
134612012
134612012
134612012
203.5 x
0.706345
2.23872e+20 pow
3.16228 sqrt

Our files numbers.txt and success.txt are located in the x86 folder in our project folder.  Also when the code is built,
 the debugged, and then run there are no changes made to the success.txt file which is an empty text file that we 
created.  What are we doing wrong?