I have been following a C tutorial and using DevC++. When I write this code:

#include <iostream>
using namespace std;

int main ()
{
  cout << "Hello World!";
  return 0;
}

and try to compile and run, I get this file popping up...


[*] cstddef


// Copyright (C) 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.

It continues to talk about the GNU General Public License for a few paragraphs.
And then it reads...

/** @file cstddef
* This is a Standard C++ Library file. You should @c #include this file
* in your programs, rather than any of the "*.h" implementation files.
*
* This is the C++ version of the Standard C Library header @c stddef.h,
* and its contents are (mostly) the same as that header, but are all
* contained in the namespace @c std.

Then it has this code at the bottom?

#ifndef _CPP_CSTDDEF
#define _CPP_CSTDDEF 1

#pragma GCC system_header

#include <stddef.h>

namespace std 
{
  using ::ptrdiff_t;
  using ::size_t;
}

#endif

I have searched for an answer but can find none. So I turn here.

Recommended Answers

All 8 Replies

Is this a compilation warning or error? I'm not sure I understand what you mean by "I get this file popping up...".

Ty for your reply.

After I write the code:

// my first program in C++

#include <iostream>
using namespace std;

int main ()
{
  cout << "Hello World!";
  return 0;
}

I hit f9.
The compile progress window opens. After a second or two, instead of the Dos window
opening, I get that [*]cstddef file opening.

I tried it in Microsoft Visual Studio and it runs fine. I can only guess that it mya be a quirk of or in your compiler.

Reinstall the Compiler...may be u can get rid of this problem..

I am using wxDev C++(Dev C++ with wxWidgets) & it is working Fine...

I haven't used that compiler so this is a shot in the dark...

Is your file extension .c? I wonder if it is complaining that it is trying to compile a C program but you are using CPP headers?

So, the file extensions are .cpp. Would that make a huge difference if I am programming in C?

If so, can I save the files with .c in DevC++?

TY for your reply.

So, the file extensions are .cpp. Would that make a huge difference if I am programming in C?

If so, can I save the files with .c in DevC++?

TY for your reply.

Some compilers make assumptions based on the extension type.

Just out of curiosity, if you are following a C tutorial, why is your program written in C++? This is as plain vanilla C++ as one can possibly write.

My only guesses at this point would mirror the above: (1) the compiler has an install problem; (2) the compiler is misconfigured; (3) you have some weird characters buried in your source file that somehow confused the compiler.

Sorry, for taking so long on replying, was gone for a bit.

I don't know (can't) tell you what's up. I tried a different tutorial. One that seems a bit more "EDUCATIONAL". I have not done anything different, exept learned a tad more, and it has not happened again.


Ty for all of your reply's.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.