|
Re: Trying to run Hello World [message #1752335 is a reply to message #1752284] |
Sun, 22 January 2017 08:08 |
David Vavra Messages: 1426 Registered: October 2012 |
Senior Member |
|
|
I've installed Eclipse Neon.2 and MinGW in Windows 7 Professional.
The Hello World project compiles and runs OK.
I added includes for stdint.h and sys/types.h
and the declaration __intptr_t pint;
That, too, worked.
I then converted the project to use a generated makefile and to run make.
It builds and runs OK as long as I build from within Eclipse.
I was getting something similar for the __intptr_t declaration when building using standalone make.
However I found that there were two installations of g++.
The one being used when building standalone came with Perl64.
Fixing the path to use the g++ that came with MinGW fixed the problem.
Can you be more specific about how and when you encounter these errors?
Are you building from within Eclipse?
Are you sure there is only one GCC installed? Execute "where g++".
Can you attach the build log?
[Updated on: Sun, 22 January 2017 13:41] Report message to a moderator
|
|
|
|
Re: Trying to run Hello World [message #1752392 is a reply to message #1752381] |
Mon, 23 January 2017 11:23 |
Jonah Graham Messages: 416 Registered: June 2014 |
Senior Member |
|
|
I can see some other people with similar errors with mingw. I haven't reproduced your problem, but this looks like a mistake in the mingw header files.
(From your log you are running the mingw32 version of g++)
From your log:
g++ -O0 -g3 -Wall -c -fmessage-length=0 -o "src\\HW.o" "..\\src\\HW.cpp"
In file included from c:\mingw\include\wchar.h:61:0,
from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\cwchar:44,
from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\postypes.h:40,
from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\iosfwd:40,
from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\iostream:39,
from ..\src\HW.cpp:9:
c:\mingw\include\wctype.h:92:1: error: '_BEGIN_C_DECLS' does not name a type
_BEGIN_C_DECLS
^
_BEGIN_C_DECLS is defined in w32api.h, included by _mingw.h which is just above the error message line. So either some of those conditions are wrong, or something in your program have caused a problem.
Can you post two things:
1. The top 9 lines of your program (up until ..\src\HW.cpp:9). Although unlikely, perhaps you have defined something that has caused the header file error to pop-up.
2. The pre-processed HW.cpp file. Easiest way is to add -save-temps to other flags and attach the .i file. (Check that the contents of the file is ok to upload , doesn't contain anything you don't want public as it will contain your entire HW.cpp and all the headers it includes).
|
|
|
|
Re: Trying to run Hello World [message #1752413 is a reply to message #1752394] |
Mon, 23 January 2017 14:37 |
David Vavra Messages: 1426 Registered: October 2012 |
Senior Member |
|
|
_BEGIN_C_DECLS depends on __cplusplus which I would think defined when compiling a C++ file.
Perhaps something undefined it or this entire section of code is inactive.
Definition of _BEGIN_C_DECLS starting win32api.h:173
#ifdef __cplusplus
# define _EXTERN_C extern "C"
# define _BEGIN_C_DECLS extern "C" {
# define _END_C_DECLS }
#else
:
#endif
Put the following at the top of HW.cpp file and see what you get.
#ifdef __cplusplus
#pragma message "cplusplus is defined"
#else
#pragma message "cplusplus is NOT defined"
#endif
The guard statement for __off32_t is more complicated.
The typedef for it is at sys/types.h:62:
To list all g++.exe files in path order :
In a command window type "where g++"
C:\Users\dvavra>where g++
c:\Apps\MinGW\bin\g++.exe
C:\Apps\Perl64\site\bin\g++.exe
The version of GCC I downloaded from MinGW is 5.3.0
You seem to be using 4.8.1
[Updated on: Mon, 23 January 2017 21:48] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03672 seconds