Compiling older code with gcc/g++

  • Thread starter Pollywoggy
  • Start date
  • Tags
    Code
In summary, the conversation discusses the issue of older cpp code written for gcc 2.95 not compiling under g++ 4.x or 3.3. The possibility of using a different compiler or making modifications to the code is mentioned, but ultimately it is determined that the best solution would be to install gcc 2.95. The inability to post the code due to proprietary restrictions is also mentioned.
  • #1
Pollywoggy
53
0
I have some older cpp code that was written when gcc 2.95 was in general use, but this code does not compile under g++ 4.x or even 3.3.

Is there a way to tell the compiler to compile code that is old and not written to present standards? I seem to recall there is a way to do it but I do not recall specifics. Even if I had the programming skill to do it, the code says that it is forbidden to modify the code without permission from the company that developed it. They provided the code but do not allow it to be modified (it is for a game).

thanks
 
Technology news on Phys.org
  • #2
If it was written to c++ standards at the time it should still work. Presumably it included some g++ non-standard additions that have been dropped - can you post specific examples?
 
  • #3
Pollywoggy said:
I have some older cpp code that was written when gcc 2.95 was in general use, but this code does not compile under g++ 4.x or even 3.3.

Is there a way to tell the compiler to compile code that is old and not written to present standards?
...

Not really.
Maybe it uses "varargs" instead "stdarg" (the standard). The best thing to do is to install gcc 2.95 , etc...
 
  • #4
Rogerio said:
Not really.
Maybe it uses "varargs" instead "stdarg" (the standard). The best thing to do is to install gcc 2.95 , etc...

Thanks, I think that might be the easiest thing to do. I could not post the problem code here because it is proprietary.
 

1. What is the purpose of compiling older code with gcc/g++?

Compiling older code with gcc/g++ allows it to be run on newer systems that may not support the original compiler or language used to write the code. It also ensures compatibility with any changes or updates made to the gcc/g++ compiler.

2. How do I compile older code with gcc/g++?

To compile older code with gcc/g++, you will need to use the appropriate flags and options to specify the language and target platform. You may also need to make any necessary changes to the code to ensure compatibility with the newer compiler.

3. Can I compile code written in a different language with gcc/g++?

Yes, gcc/g++ supports multiple languages such as C, C++, and Fortran. However, you may need to use different flags and options to compile code written in a different language compared to code written in C or C++.

4. Will my code still work after being compiled with gcc/g++?

If your code is written in a supported language and follows proper syntax and conventions, it should still work after being compiled with gcc/g++. However, if there are any errors or incompatibilities, they may need to be addressed before the code will run correctly.

5. Are there any potential issues I should be aware of when compiling older code with gcc/g++?

Yes, there may be compatibility issues or syntax changes between older versions of the language and newer versions supported by gcc/g++. It is important to thoroughly test the code after compilation to ensure it is functioning as intended.

Similar threads

Replies
6
Views
1K
  • Programming and Computer Science
Replies
20
Views
2K
  • Programming and Computer Science
Replies
27
Views
4K
  • Programming and Computer Science
Replies
30
Views
4K
  • Programming and Computer Science
Replies
16
Views
8K
  • Programming and Computer Science
Replies
5
Views
3K
  • Programming and Computer Science
Replies
6
Views
5K
  • Programming and Computer Science
Replies
31
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
1K
Back
Top