![]() |
|
#1
|
|||
|
|||
basic question regarding compiling a programHello all,
Background: I am new to compiling programs. I was asked to compile an X.lib file to be used on Solaris 9 and be compatible with C++ 5.5 patch 113817-19. From my research C++ 5.5 came with Sun Studio 8. I do not have access to Sun Studio 8 therefore would it be possible to compile this using gcc 3.4.6? Or could I download and install Sun Studio 11, the newest version and compile this program? In either case can someone give me general guidelines on how to go about compiling this lib. I was given two files: X.cpp X.h I appreciate any information. Thanks. |
|
#2
|
|||
|
|||
Re: basic question regarding compiling a programI couldn't understand what you say. Can you explained in detail ?
__________________
Linux is the best OS in the world. |
|
#3
|
|||
|
|||
Re: basic question regarding compiling a programWhen I do a g++ x.cpp I get this:
x.cpp:1:20: StdAfx.h: No such file or directory In file included from x.cpp:2: ./x.h:8: error: using-declaration for non-member at class scope ./x.h:8: error: expected `;' before "Encrypt" ./x.h:9: error: using-declaration for non-member at class scope ./x.h:9: error: expected `;' before "Decrypt" In file included from x.cpp:2: ./x.h:10:3: warning: no newline at end of file x.cpp:13: error: expected constructor, destructor, or type conversion before "x" x.cpp:37: error: expected constructor, destructor, or type conversion before "x" |
|
#4
|
|||
|
|||
Re: basic question regarding compiling a programAre you compiling in text mode ?
I suggest you compile in a IDE environment because i also a linux user but normally i will compile at Eclipse. What distribution you are using ? You can ask this question in linux forum and post the answer in this forum. Thanks. __________________
Linux is the best OS in the world. |
|
#5
|
|||
|
|||
Re: basic question regarding compiling a programWhat GGC version are you using ? My compiler always no newline at the end of file.
I hope this will help others. __________________
Linux is the best OS in the world. |
|
#6
|
|||
|
|||
Re: basic question regarding compiling a programI am using gcc version 3.4.6.
I am using Solaris 9. currently I don't have and IDE to compile this program in. Could I compile without the IDE environment? Thanks. |
|
#7
|
|||
|
|||
Re: basic question regarding compiling a programSo, this code is apparently being ported from Visual C++ (hence the StdAfx error). There may or may not have been important stuff in StdAfx.h, but can you post all of X.cpp and X.h so we can look for the other errors?
|
|
#8
|
|||
|
|||
Re: basic question regarding compiling a programHere are the two files. From what I know now is that this program may have been written as you said in Visual C++ and now they need it compiled in Solaris 9. Is this possible?
{ultra5-9 root} more StdEncryption.cpp #include "StdAfx.h" #include "./StdEncryption.h" //#using <mscorlib.dll> StdEncryption::StdEncryption(void) { } StdEncryption::~StdEncryption(void) { } std::string StdEncryption::Encrypt(std::string privateKey, std::string decrypted Str){ int i, n, keyLen, strLen; std::string strBuff; char ch[2]; char testChar; keyLen=privateKey.length(); if (keyLen==0){ return(decryptedStr); } else{ strLen=decryptedStr.length(); for(i=0; i<strLen; i++){ n = decryptedStr[i]; n = n + privateKey[(i+1) % keyLen]; testChar=(char)(n & 0xFF); ch[0]=testChar; ch[1]='\0'; strBuff.append(ch); } } return(strBuff); } std::string StdEncryption: Str){ int i, n, keyLen, strLen; std::string strBuff; char ch[2]; char testChar; keyLen=privateKey.length(); if (keyLen==0){ return(encryptedStr); } else{ strLen=encryptedStr.length(); for(i=0; i<strLen; i++){ n = encryptedStr[i]; n = n - privateKey[(i+1) % keyLen]; testChar=(char)(n & 0xFF); ch[0]=testChar; ch[1]='\0'; strBuff.append(ch); } } return(strBuff); } {ultra5-9 root} more StdEncryption.h #pragma once class StdEncryption { public: StdEncryption(void); ~StdEncryption(void); std::string Encrypt(std::string privateKey, std::string decryptedStr); std::string Decrypt(std::string privateKey, std::string encryptedStr); }; |
|
#9
|
|||
|
|||
Re: basic question regarding compiling a programQuote:
StdEncryption.h: CPP / C++ / C Code:
StdEncryption.cpp (or StdEncryption.C or StdEncryption.cxx or whatever convention your installation likes for C++ source files) CPP / C++ / C Code:
Should compile with any standard C++ compiler installation. Ready for testing/debugging. Regards, Dave |
|
#10
|
|||
|
|||
Re: basic question regarding compiling a programHello cornsnap. can you explain a bit what do this program acts?
Are you wrote the program ? Thanks. __________________
Linux is the best OS in the world. |
Recent GIDBlog
First week of IA training by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| BOOKEEPING program, HELP!! | yabud | C Programming Language | 10 | 17-Nov-2006 03:48 |
| Pipeline freeze simulation | darklightred | CPP / C++ Forum | 6 | 27-Jul-2006 19:37 |
| creating a file in [c] | i hate c | C Programming Language | 15 | 21-Nov-2005 12:52 |
| Help needed on visual C++ basic math program | xoBeBExo | CPP / C++ Forum | 5 | 18-Nov-2005 01:52 |
| Enter key in basic c program | hopesfall | C Programming Language | 2 | 26-Mar-2005 16:09 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The