Solved

FILE tyoe def in C compiles under MS VS but not G++

Posted on 2001-06-06
3
243 Views
Last Modified: 2010-04-02
hi, i have code written largely in C++ but which makes use of the C FILE type def. It compiles and works fine under MS Visual Studio 6 C++ but i want to compile it on a unix box using G++, and at this point the compilation fails. It reports a syntax error with the line:
FILE *fp;

anyone know of a fix/reason for this??

thanks

Calum
0
Comment
Question by:calum
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
robpitt earned 50 total points
ID: 6158944
Obvious question : have done a #include <stdio.h> ?
0
 
LVL 5

Expert Comment

by:robpitt
ID: 6158947
PS whats the exact error.
0
 

Author Comment

by:calum
ID: 6159217
i didn;t have stdio in the file when i compiled it using ms vs, and it worked fine, so i was confused when it didn;t compile using gcc. when i added it to gcc i got a load of linker errors, but when i compiled it under g++, it worked.

i don;t understand why, but i'll live with it!

thanks - you can have the points!!

rgds

calum

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question