How to complie a c++ program in Unix or Cygwin?


 
Thread Tools Search this Thread
Top Forums Programming How to complie a c++ program in Unix or Cygwin?
# 8  
Old 03-22-2007
Quote:
No, it shouldn't. Make depends on having a Makefile

make does NOT depend on having a makefile.

it has builtin implicit rules.

you need the g++ compiler

try make -pns | grep CXX
# 9  
Old 03-26-2007
Quote:
Originally Posted by meili100
How to compile the following "test.cpp" code? It reports "std error"...

#include <vector>
#include<iostream>

int main(){
std:vector <int> a1(10);
a1[0]=12;
std:cout<<a1[0]<<endl;
return 0;
}

Instead of colon (Smilie after std u shld use scope resolution operator (:: ) That will solve ur problem ... but if u wanna use endl then u shld compile with g++ as endl is compile with g++ complier .... and give space after include .... the syntax shld be perfect then only code will complie ... thanks
# 10  
Old 03-27-2007
c++ compilation

Hi,
U can also compile c++ programs with gcc
i am giving an example which need one library to be linked
gcc xyz.cpp -lstdc++
# 11  
Old 03-28-2007
Thank you. But what does "-lstdc++" mean here?

Quote:
Originally Posted by manoj.rana
Hi,
U can also compile c++ programs with gcc
i am giving an example which need one library to be linked
gcc xyz.cpp -lstdc++
# 12  
Old 03-28-2007
Smilie Smilie Smilie

Last edited by meili100; 03-28-2007 at 02:15 PM..
# 13  
Old 03-28-2007
Quote:
Originally Posted by bigearsbilly
make does NOT depend on having a makefile.
I apologize gmake does not need a makefile. It should be noted that a standard make will not do this and this behavior is not something to rely on.
# 14  
Old 03-29-2007
"-lstdc++" mean

"-lstdc++" is a c++ libraray to be linked with gcc .
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Windows & DOS: Issues & Discussions

Cygwin script to transfer file from windows to UNIX

Hi, Objective is to transfer files from windows server to Unix server using cygwin. I have installed cygwin, and I manually execute commands and transfer files from windows to unix using sftp. These are steps I execute 1) Run cmd 2) Run cygwin 3) At prompt type sftp user1@uniserver 4) lcd... (2 Replies)
Discussion started by: wahi80
2 Replies

2. Shell Programming and Scripting

Execute a shell script in UNIX server from Cygwin

Hi All, We have shell scripts in UNIX ( Sun OS ) server. Also in my windows machine i have Cygwin installed. Now is there a way to execute Shell script available in UNIX server from Cygwin? (4 Replies)
Discussion started by: Girish19
4 Replies

3. HP-UX

UNIX apps on CYGWIN

Hi all, am new to the forum. i would like to check with the community whether anyone had tried to run self-developed UNIX apps on the CYGWIN? Does the CYGWIN presents a friendly environment to host the UNIX apps? thanks :) (14 Replies)
Discussion started by: lchunleo
14 Replies

4. UNIX for Dummies Questions & Answers

How can I rebuild applications that developed in UNIX? I need to use it in windows os with cygwin

I need to rebuild an application that developed in unix environment and run in windows OS with cygwin. so How can I rebuild from the source code? is there any one who said something on this regard? (2 Replies)
Discussion started by: bejirond
2 Replies

5. UNIX for Dummies Questions & Answers

Cross complie linux make files onto a windows 7 machine using PGI Cygwin

Hello, I am very unfamiliar with linux/unix (don't even know the difference), but am trying to get some linux software to run on my Windows machine for my research. I have the makefiles for the software, and it is designed to be compiled in the PGI complier, which I also have. When i... (6 Replies)
Discussion started by: roba87
6 Replies

6. UNIX for Dummies Questions & Answers

Cygwin not waiting for program in background (solved)

Hello, I know this isn't exactly a Unix question, but I wasn't able to find much information elsewhere. I'm trying to run a program in the background using Cygwin on a Windows machine, then use the wait command to pause before proceeding. Unfortunately, as I've confirmed using ps aux, the... (0 Replies)
Discussion started by: ocdcollector
0 Replies

7. UNIX for Dummies Questions & Answers

Unix Emulator Cygwin

Hi, I installed unix emulator cygwin, it does not allow me to open vi editor. Can anybody know if cygwin supports vi. if not can somebody please refer a good emulator. (5 Replies)
Discussion started by: siquadri
5 Replies

8. Shell Programming and Scripting

using alias in cygwin unix

i have a cygwin unix and i would like to use alias to save a cd command.. however i lose this alias when i close out cygwin and log back in.. is there any way to save this command so that i can use it every time i log in? i am using cygwin on windows xp. thanks. (1 Reply)
Discussion started by: npatwardhan
1 Replies

9. Windows & DOS: Issues & Discussions

Basic Unix Commands for cygwin

Hi. I'm New user for this Forum.Presently i'm working with Cygwin I want to know the basic commands that will be used for Cygwin. Can anyone guide me on this regards Thanks & Regards Sanjay (0 Replies)
Discussion started by: sanjay.karthik
0 Replies

10. Programming

Help about SCO unix complie problem ?

Can you tell me why ? Thank you ! $ cc -L /usr/lib server.c -lsocket UX:acomp: WARNING: "server.c", line 60: argument is incompatible with prototype6 Undefined first referenced symbol in file ffush server.o... (2 Replies)
Discussion started by: loudingyang
2 Replies
Login or Register to Ask a Question