User forums > Help
Can't build "hello world". --- mac, gcc --- unexpected EOF --- Status 2.
(1/1)
RichardWayneSmith:
Hi all,
I am an intermediate level c++ programmer trying to set up code blocks and gcc.
I am running on an old mac (snow leopard - mac tower) and using the current version of Code::Blocks IDE. I am not planning to do anything amazing. Just write a few simple programs to get back in practice with c++, and modify some text files.
FIRST:
I believe that I have the gcc complier correctly installed. When I go into the terminal, and type "gcc -v" I get:
Towers-Mac-Pro:~ tower$ gcc -v
Using built-in specs.
Target: i686-apple-darwin10
Configured with: /var/tmp/gcc/gcc-5664~38/src/configure --disable-checking --enable-werror --prefix=/usr --mandir=/share/man --enable- languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin10 --program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10 --target=i686-apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5664)
SECOND:
The Code::Blocks application is placed in my application folder. (Nestled between Chess.app and Dashboard.app.)
THIRD:
In my programming projects folder, I have a testProject folder. This currently contains:
bin (folder)
doxygen (folder)
main.cpp // This is the standard hello world console app. i added a few characters to "hello world" just to make sure that the right hello world is running.
// I am sure that the c++ program is syntactically correct.
obj (folder)
testProject.cbp
testProject.layout
FOURTH:
Inside the Code::Blocks, IDE, in the left hand window pane, I see:
Workspace
testProject
Sources
main.cpp
From this location / state, I try to build the project.
FIFTH:
When I try to build, I get the following error messages:
------------- Build: Debug in testProject (compiler: GNU GCC Compiler)---------------
g++ -Wall -fexceptions -g -Wall -c "/Rick's Stuff/Programming Projects/testProject/main.cpp" -o obj/Debug/main.o
s: -c: line 0: unexpected EOF while looking for matching `"'
s: -c: line 1: syntax error: unexpected end of file
Process terminated with status 2 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
CONCLUSIONS:
The first line of the error message above suggests that the gcc compiler is attached to the project and trying to build the code. But I do not know why it does not see the main.cpp file, as it is in the project, and I ran the builder from the project.
Any help would be greatly appreciated. Many thanks!
Warm regards, Rick.
Jenna:
I suggest to remove the apostroph in the file-path and probably also the space.
Easior Lars:
--- Quote from: RichardWayneSmith on March 13, 2015, 10:11:57 pm ---
------------- Build: Debug in testProject (compiler: GNU GCC Compiler)---------------
g++ -Wall -fexceptions -g -Wall -c "/Rick's Stuff/Programming Projects/testProject/main.cpp" -o obj/Debug/main.o
s: -c: line 0: unexpected EOF while looking for matching `"'
s: -c: line 1: syntax error: unexpected end of file
Process terminated with status 2 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
--- End quote ---
It seems like encoding problem. You should best check the encoding setting of your system and the editor of Code::Blocks? Can you paste the build log of the following command line:
--- Code: ---$ cd /Rick's Stuff/Programming Projects/testProject/
$ g++ main.cpp
--- End code ---
Jenna:
--- Quote from: Easior Lars on March 14, 2015, 01:25:34 am ---
--- Quote from: RichardWayneSmith on March 13, 2015, 10:11:57 pm ---
------------- Build: Debug in testProject (compiler: GNU GCC Compiler)---------------
g++ -Wall -fexceptions -g -Wall -c "/Rick's Stuff/Programming Projects/testProject/main.cpp" -o obj/Debug/main.o
s: -c: line 0: unexpected EOF while looking for matching `"'
s: -c: line 1: syntax error: unexpected end of file
Process terminated with status 2 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
--- End quote ---
It seems like encoding problem. You should best check the encoding setting of your system and the editor of Code::Blocks? Can you paste the build log of the following command line:
--- Code: ---$ cd /Rick's Stuff/Programming Projects/testProject/
$ g++ main.cpp
--- End code ---
--- End quote ---
No, it looks like an apostroph (single quote) in the command line, that does not get escaped (correctly) in my eyes.
I just tried similar path on linux and get the same result.
So again, removing the apostroph should work.
And again removing spaces from path is also a good idea, because sometimes older tools stumble over it.
RichardWayneSmith:
Hello everyone,
I did some experiments.
If I remove the apostrophe but not the spaces, then the log in the bottom window of Code::Blocks looks like it runs, but the console gives this message:
/RicksStuff/Programming Projects/testProject/main
Towers-Mac-Pro:~ tower$ /RicksStuff/Programming Projects/testProject/main
-bash: /RicksStuff/Programming: No such file or directory
Towers-Mac-Pro:~ tower$
If I remove the apostrophe AND the spaces in the file names, the console gives this message:
/RicksStuff/ProgrammingProjects/testProject/main
Towers-Mac-Pro:~ tower$ /RicksStuff/ProgrammingProjects/testProject/main
Hello world! Mine! All Mine!!! Bwa-ha-ha-ha!
Towers-Mac-Pro:~ tower$
So the problem is completely resolved. The old gcc compiler does not like spaces in file names, and the apostrophe is a complete no go.
It might be worthwhile to put a check for the apostrophe in the mac version of Code::Blocks, (followed by a warning if found), as this is a legal file name on this platform.
Many thanks for the help!
Warm regards, Rick.
Navigation
[0] Message Index
Go to full version