public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Help with g++ (Newbie)
@ 2006-12-05  6:01 abhivg
  2006-12-05  7:01 ` Ian Lance Taylor
  2006-12-05  8:06 ` Purnendu
  0 siblings, 2 replies; 7+ messages in thread
From: abhivg @ 2006-12-05  6:01 UTC (permalink / raw)
  To: gcc-help


Hi,

I am a total newbie to g++. I have a c++ project developed using the vc++
IDE which I need to build using g++. I am using Arm Toolchain on win xp for
this. The c++ project was to develop a static library. So I think i need to
generate an archive file using the 'ar' tool.

I have done the following:
1) I have seperated all the header and source files from the vc project
2) I was able to compile all the cpp files using g++. There were no errors.
3) I generated the archive file using the 'ar' tool. The archive file also
got generated.
4) I wrote a main.cpp file in which I will use the archive file

Problems I am having:
1) I tried to build the main.cpp file but it gave errors in the header file
included in main.cpp. This header file contains the functions that I have
exposed to access the methods in the archive file. So I tried to compile(??)
the some other header file and it gave me errors too.
2) The errors I am getting are that it is not able to find the standard
include files like "math.h", <vector> etc.

My doubts are:
1) The header file that I have exposed is included in the archive file
generated. So how did the archive get compiled without any errors?
2) Why is gcc not able to access the standard include files when compiling
header seperately but is able to access it when compiling cpp files?
2) What does it mean when I do the following: "g++ somefile.h".   Am I
compiling a header file???
3) Also how do I generate an exe instead of an .out file?

-- 
View this message in context: http://www.nabble.com/Help-with-g%2B%2B-%28Newbie%29-tf2759497.html#a7693802
Sent from the gcc - Help mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Help with g++ (Newbie)
  2006-12-05  6:01 Help with g++ (Newbie) abhivg
@ 2006-12-05  7:01 ` Ian Lance Taylor
  2006-12-05 10:20   ` abhivg
  2006-12-05  8:06 ` Purnendu
  1 sibling, 1 reply; 7+ messages in thread
From: Ian Lance Taylor @ 2006-12-05  7:01 UTC (permalink / raw)
  To: abhivg; +Cc: gcc-help

abhivg <abhi.vg@gmail.com> writes:

> 1) I tried to build the main.cpp file but it gave errors in the header file
> included in main.cpp. This header file contains the functions that I have
> exposed to access the methods in the archive file. So I tried to compile(??)
> the some other header file and it gave me errors too.
> 2) The errors I am getting are that it is not able to find the standard
> include files like "math.h", <vector> etc.

Tell us the precise command that you ran and the precise output that
you got.  We can't guess.


> 2) What does it mean when I do the following: "g++ somefile.h".   Am I
> compiling a header file???

That means to precompile a header file.  See the "Using Precompiled
Headers" section in the documentation.


> 3) Also how do I generate an exe instead of an .out file?

I assume that by "an exe" you mean an executable file (the default
name on Unix is "a.out", but you can call it anything you like;
executable files generally have no extension on Unix).  g++ will
generate this by default.  For example "g++ hello.cc" will generate
the executable file "a.out".

I assume that by "an .out file" you mean an object file (on Unix these
usually have an extension of ".o").  g++ will generate that if you use
the -c option.  See the documentation.

Ian

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Help with g++ (Newbie)
  2006-12-05  6:01 Help with g++ (Newbie) abhivg
  2006-12-05  7:01 ` Ian Lance Taylor
@ 2006-12-05  8:06 ` Purnendu
  2006-12-05 12:14   ` abhivg
  1 sibling, 1 reply; 7+ messages in thread
From: Purnendu @ 2006-12-05  8:06 UTC (permalink / raw)
  To: abhivg; +Cc: gcc-help

Hello,

w.r.t
>2) The errors I am getting are that it is not able to find the standard
>include files like "math.h", <vector> etc.
U need to compile with -lm option, i mean u need to link with the math library.

~
purnendu

On 12/5/06, abhivg <abhi.vg@gmail.com> wrote:
>
> Hi,
>
> I am a total newbie to g++. I have a c++ project developed using the vc++
> IDE which I need to build using g++. I am using Arm Toolchain on win xp for
> this. The c++ project was to develop a static library. So I think i need to
> generate an archive file using the 'ar' tool.
>
> I have done the following:
> 1) I have seperated all the header and source files from the vc project
> 2) I was able to compile all the cpp files using g++. There were no errors.
> 3) I generated the archive file using the 'ar' tool. The archive file also
> got generated.
> 4) I wrote a main.cpp file in which I will use the archive file
>
> Problems I am having:
> 1) I tried to build the main.cpp file but it gave errors in the header file
> included in main.cpp. This header file contains the functions that I have
> exposed to access the methods in the archive file. So I tried to compile(??)
> the some other header file and it gave me errors too.
> 2) The errors I am getting are that it is not able to find the standard
> include files like "math.h", <vector> etc.
>
> My doubts are:
> 1) The header file that I have exposed is included in the archive file
> generated. So how did the archive get compiled without any errors?
> 2) Why is gcc not able to access the standard include files when compiling
> header seperately but is able to access it when compiling cpp files?
> 2) What does it mean when I do the following: "g++ somefile.h".   Am I
> compiling a header file???
> 3) Also how do I generate an exe instead of an .out file?
>
> --
> View this message in context: http://www.nabble.com/Help-with-g%2B%2B-%28Newbie%29-tf2759497.html#a7693802
> Sent from the gcc - Help mailing list archive at Nabble.com.
>
>



-- 
with regards,
purnendu ghosh
-----------------------------------------------------------------------
If you can D.R.E.A.M it you can D.O it
-----------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Help with g++ (Newbie)
  2006-12-05  7:01 ` Ian Lance Taylor
@ 2006-12-05 10:20   ` abhivg
  2006-12-05 11:42     ` Peter Cech
  0 siblings, 1 reply; 7+ messages in thread
From: abhivg @ 2006-12-05 10:20 UTC (permalink / raw)
  To: gcc-help


Hi,

WRT
> Tell us the precise command that you ran and the precise output that
> you got.  We can't guess.

I am working in a directory 'New Folder' which contains the following files:
- main.cpp                 //main program
- fittinglib.a                //library/archive file
- CurveFittingAPI.h     //header file containing the exposed functions from
the library file fittinglib.a

I ran the following command:
g++ -Wall main.cpp fittinglib.a

I got the following output:

C:\test2\New Folder>g++ -Wall main.cpp fittinglib.a
main.cpp:4:20: no include path in which to search for string.h
In file included from main.cpp:5:
CurveFittingAPI.h:15:18: no include path in which to search for vector
In file included from main.cpp:5:
CurveFittingAPI.h:52: error: `std::vector' has not been declared
CurveFittingAPI.h:52: error: expected `,' or `...' before '<' token
CurveFittingAPI.h:53: error: ISO C++ forbids declaration of `parameter' with
no
type
main.cpp: In function `int main()':
main.cpp:10: error: `strcpy' undeclared (first use this function)
main.cpp:10: error: (Each undeclared identifier is reported only once for
each f
unction it appears in.)
main.cpp:13: warning: unused variable 'success'
g++: Internal error: Signal 1 (program cc1plus)
Please submit a full bug report.
Send email to arm-gcc@codesourcery.com for instructions.


> I assume that by "an exe" you mean an executable file (the default
> name on Unix is "a.out", but you can call it anything you like;
> executable files generally have no extension on Unix).  g++ will
> generate this by default.  For example "g++ hello.cc" will generate
> the executable file "a.out".
> 
> I assume that by "an .out file" you mean an object file (on Unix these
> usually have an extension of ".o").  g++ will generate that if you use
> the -c option.  See the documentation.

Yes, by exe I meant an executable file. By a '.out' file, I meant an output
file or UNIX executable file. But, I would like to create an executable file
on Windows(.exe) using g++. Pardon my ignorance, but is that possible or
does it generate only UNIX executable files?

thanks for replying,
Abhi


Ian Lance Taylor-3 wrote:
> 
> abhivg <abhi.vg@gmail.com> writes:
> 
>> 1) I tried to build the main.cpp file but it gave errors in the header
>> file
>> included in main.cpp. This header file contains the functions that I have
>> exposed to access the methods in the archive file. So I tried to
>> compile(??)
>> the some other header file and it gave me errors too.
>> 2) The errors I am getting are that it is not able to find the standard
>> include files like "math.h", <vector> etc.
> 
> Tell us the precise command that you ran and the precise output that
> you got.  We can't guess.
> 
> 
>> 2) What does it mean when I do the following: "g++ somefile.h".   Am I
>> compiling a header file???
> 
> That means to precompile a header file.  See the "Using Precompiled
> Headers" section in the documentation.
> 
> 
>> 3) Also how do I generate an exe instead of an .out file?
> 
> I assume that by "an exe" you mean an executable file (the default
> name on Unix is "a.out", but you can call it anything you like;
> executable files generally have no extension on Unix).  g++ will
> generate this by default.  For example "g++ hello.cc" will generate
> the executable file "a.out".
> 
> I assume that by "an .out file" you mean an object file (on Unix these
> usually have an extension of ".o").  g++ will generate that if you use
> the -c option.  See the documentation.
> 
> Ian
> 
> 

-- 
View this message in context: http://www.nabble.com/Help-with-g%2B%2B-%28Newbie%29-tf2759497.html#a7696736
Sent from the gcc - Help mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Help with g++ (Newbie)
  2006-12-05 10:20   ` abhivg
@ 2006-12-05 11:42     ` Peter Cech
  2006-12-05 12:12       ` abhivg
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Cech @ 2006-12-05 11:42 UTC (permalink / raw)
  To: gcc-help

On Tue, Dec 05, 2006 at 02:19:52 -0800, abhivg wrote:
> 
> Hi,
> 
> WRT
> > Tell us the precise command that you ran and the precise output that
> > you got.  We can't guess.
> 
> I am working in a directory 'New Folder' which contains the following files:
> - main.cpp                 //main program
> - fittinglib.a                //library/archive file
> - CurveFittingAPI.h     //header file containing the exposed functions from
> the library file fittinglib.a
> 
> I ran the following command:
> g++ -Wall main.cpp fittinglib.a
> 
> I got the following output:
> 
> C:\test2\New Folder>g++ -Wall main.cpp fittinglib.a
> main.cpp:4:20: no include path in which to search for string.h
> In file included from main.cpp:5:
> CurveFittingAPI.h:15:18: no include path in which to search for vector
> In file included from main.cpp:5:

Looks like something went wrong when installing the compiler. Are you
using MinGW or Cygwin?

> > I assume that by "an exe" you mean an executable file (the default
> > name on Unix is "a.out", but you can call it anything you like;
> > executable files generally have no extension on Unix).  g++ will
> > generate this by default.  For example "g++ hello.cc" will generate
> > the executable file "a.out".
> > 
> > I assume that by "an .out file" you mean an object file (on Unix these
> > usually have an extension of ".o").  g++ will generate that if you use
> > the -c option.  See the documentation.
> 
> Yes, by exe I meant an executable file. By a '.out' file, I meant an output
> file or UNIX executable file. But, I would like to create an executable file
> on Windows(.exe) using g++. Pardon my ignorance, but is that possible er
> does it generate only UNIX executable files?

Might be it is an exe, but with wrong extension (never tried myself).
Anyway, you can use

  g++ main.cpp -o myProgram.exe

to generate executable with an appropriate name.

Hope it helps,
Peter

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Help with g++ (Newbie)
  2006-12-05 11:42     ` Peter Cech
@ 2006-12-05 12:12       ` abhivg
  0 siblings, 0 replies; 7+ messages in thread
From: abhivg @ 2006-12-05 12:12 UTC (permalink / raw)
  To: gcc-help


I am using Arm toolchain on windows XP. I wil try installing the latest
version. Maybe that could help. Thanks for the suggestion,
Abhi



Peter Cech wrote:
> 
> On Tue, Dec 05, 2006 at 02:19:52 -0800, abhivg wrote:
>> 
>> Hi,
>> 
>> WRT
>> > Tell us the precise command that you ran and the precise output that
>> > you got.  We can't guess.
>> 
>> I am working in a directory 'New Folder' which contains the following
>> files:
>> - main.cpp                 //main program
>> - fittinglib.a                //library/archive file
>> - CurveFittingAPI.h     //header file containing the exposed functions
>> from
>> the library file fittinglib.a
>> 
>> I ran the following command:
>> g++ -Wall main.cpp fittinglib.a
>> 
>> I got the following output:
>> 
>> C:\test2\New Folder>g++ -Wall main.cpp fittinglib.a
>> main.cpp:4:20: no include path in which to search for string.h
>> In file included from main.cpp:5:
>> CurveFittingAPI.h:15:18: no include path in which to search for vector
>> In file included from main.cpp:5:
> 
> Looks like something went wrong when installing the compiler. Are you
> using MinGW or Cygwin?
> 
>> > I assume that by "an exe" you mean an executable file (the default
>> > name on Unix is "a.out", but you can call it anything you like;
>> > executable files generally have no extension on Unix).  g++ will
>> > generate this by default.  For example "g++ hello.cc" will generate
>> > the executable file "a.out".
>> > 
>> > I assume that by "an .out file" you mean an object file (on Unix these
>> > usually have an extension of ".o").  g++ will generate that if you use
>> > the -c option.  See the documentation.
>> 
>> Yes, by exe I meant an executable file. By a '.out' file, I meant an
>> output
>> file or UNIX executable file. But, I would like to create an executable
>> file
>> on Windows(.exe) using g++. Pardon my ignorance, but is that possible er
>> does it generate only UNIX executable files?
> 
> Might be it is an exe, but with wrong extension (never tried myself).
> Anyway, you can use
> 
>   g++ main.cpp -o myProgram.exe
> 
> to generate executable with an appropriate name.
> 
> Hope it helps,
> Peter
> 
> 

-- 
View this message in context: http://www.nabble.com/Help-with-g%2B%2B-%28Newbie%29-tf2759497.html#a7698268
Sent from the gcc - Help mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Help with g++ (Newbie)
  2006-12-05  8:06 ` Purnendu
@ 2006-12-05 12:14   ` abhivg
  0 siblings, 0 replies; 7+ messages in thread
From: abhivg @ 2006-12-05 12:14 UTC (permalink / raw)
  To: gcc-help


Thanks , will try that,
Abhi


Purnendu wrote:
> 
> Hello,
> 
> w.r.t
>>2) The errors I am getting are that it is not able to find the standard
>>include files like "math.h", <vector> etc.
> U need to compile with -lm option, i mean u need to link with the math
> library.
> 
> ~
> purnendu
> 
> On 12/5/06, abhivg <abhi.vg@gmail.com> wrote:
>>
>> Hi,
>>
>> I am a total newbie to g++. I have a c++ project developed using the vc++
>> IDE which I need to build using g++. I am using Arm Toolchain on win xp
>> for
>> this. The c++ project was to develop a static library. So I think i need
>> to
>> generate an archive file using the 'ar' tool.
>>
>> I have done the following:
>> 1) I have seperated all the header and source files from the vc project
>> 2) I was able to compile all the cpp files using g++. There were no
>> errors.
>> 3) I generated the archive file using the 'ar' tool. The archive file
>> also
>> got generated.
>> 4) I wrote a main.cpp file in which I will use the archive file
>>
>> Problems I am having:
>> 1) I tried to build the main.cpp file but it gave errors in the header
>> file
>> included in main.cpp. This header file contains the functions that I have
>> exposed to access the methods in the archive file. So I tried to
>> compile(??)
>> the some other header file and it gave me errors too.
>> 2) The errors I am getting are that it is not able to find the standard
>> include files like "math.h", <vector> etc.
>>
>> My doubts are:
>> 1) The header file that I have exposed is included in the archive file
>> generated. So how did the archive get compiled without any errors?
>> 2) Why is gcc not able to access the standard include files when
>> compiling
>> header seperately but is able to access it when compiling cpp files?
>> 2) What does it mean when I do the following: "g++ somefile.h".   Am I
>> compiling a header file???
>> 3) Also how do I generate an exe instead of an .out file?
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Help-with-g%2B%2B-%28Newbie%29-tf2759497.html#a7693802
>> Sent from the gcc - Help mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> with regards,
> purnendu ghosh
> -----------------------------------------------------------------------
> If you can D.R.E.A.M it you can D.O it
> -----------------------------------------------------------------------
> 
> 

-- 
View this message in context: http://www.nabble.com/Help-with-g%2B%2B-%28Newbie%29-tf2759497.html#a7698292
Sent from the gcc - Help mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-12-05 12:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-05  6:01 Help with g++ (Newbie) abhivg
2006-12-05  7:01 ` Ian Lance Taylor
2006-12-05 10:20   ` abhivg
2006-12-05 11:42     ` Peter Cech
2006-12-05 12:12       ` abhivg
2006-12-05  8:06 ` Purnendu
2006-12-05 12:14   ` abhivg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).