Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to compile c++ in Solaris using cc?

Tags:

c++

solaris

I wrote a program, which needs to be tested in Linux, Windows and Solaris. The first two were easy, but Solaris has been very troublesome. I don't have g++ in the Solaris machine I'm running those tests, so I'm stuck with cc. So, I first tried:

cc -g -o transfer transfer.cpp -lcurl

and the output was:

ld: fatal: file transfer.cpp : unknown file type
ld: fatal: no output written to transfer

If someone knows any other native C++ compiler for Solaris, please let me know, and I will give it shot. I went to Oracle Solaris website, and they said they support .cpp files in cc. Could someone please help me with that? Thanks

like image 738
cybertextron Avatar asked Dec 08 '22 22:12

cybertextron


2 Answers

It's CC for C++, not cc. So, if you want to compile C++ in solaris do

CC -g -o [output] [filename] [libraries]

for C do:

cc -g -o [output] [filename] [libraries]

please pay attention of the upper case letters!

like image 81
cybertextron Avatar answered Dec 29 '22 01:12

cybertextron


The Solaris (Sun) C++ compiler is CC (note capitals). Also note that it tends to be less standards conforming that some other compilers so your code may or may not still compile. You can improve standard library conformance with -library=stlport4 though.

like image 34
Mark B Avatar answered Dec 29 '22 01:12

Mark B