This page is a wiki. Please login or create an account to begin editing.


3 posts / 0 new
Last post
Europa's picture
Offline
Joined: 2018 Nov 19
Adding C++ Headers to Xcode

I apologize if this is in the wrong forum to post this in.

I'm trying to add a C++ header file in Xcode 2.5 on Mac OS 10.4. The header file I'm trying to add is screen.h (https://mathbits.com/MathBits/CompSci/Screen/screenfunctions.htm) and when I put the file in the project and build it, here is what I get:

Building target “Text Game” of project “Text Game” with configuration “Debug” — (21 errors)
cd "/Users/---/Documents/C++ Projects/Text Game"
/Developer/usr/bin/gcc-4.0 -x c++ -arch ppc -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -g -O0 -Wreturn-type -Wunused-variable -fmessage-length=0 -mtune=G5 -mfix-and-continue -mmacosx-version-min=10.4 -fvisibility-inlines-hidden -I/Users/---/Documents/C++\ Projects/Text\ Game/build/Text\ Game.build/Debug/Text\ Game.build/Text\ Game.hmap -F/Users/---/Documents/C++\ Projects/Text\ Game/build/Debug -I/Users/---/Documents/C++\ Projects/Text\ Game/build/Debug/include -I/Users/---/Documents/C++\ Projects/Text\ Game/build/Text\ Game.build/Debug/Text\ Game.build/DerivedSources -isysroot /Developer/SDKs/MacOSX10.4u.sdk -c /Users/---/Documents/C++\ Projects/Text\ Game/main.cpp -o /Users/---/Documents/C++\ Projects/Text\ Game/build/Text\ Game.build/Debug/Text\ Game.build/Objects-normal/ppc/main.o
In file included from /Users/---/Documents/C++ Projects/Text Game/main.cpp:3:
/Users/---/Documents/C++ Projects/Text Game/screen.h:11:24: error: windows.h: No such file or directory
/Users/---/Documents/C++ Projects/Text Game/screen.h:13:19: error: conio.h: No such file or directory
/Users/---/Documents/C++ Projects/Text Game/screen.h: In function 'void gotoxy(int, int)':
/Users/---/Documents/C++ Projects/Text Game/screen.h:39: error: 'HANDLE' was not declared in this scope
/Users/---/Documents/C++ Projects/Text Game/screen.h:39: error: expected `;' before 'hConsole'
/Users/---/Documents/C++ Projects/Text Game/screen.h:40: error: 'COORD' was not declared in this scope
/Users/---/Documents/C++ Projects/Text Game/screen.h:40: error: expected `;' before 'point'
/Users/---/Documents/C++ Projects/Text Game/screen.h:41: error: 'point' was not declared in this scope
/Users/---/Documents/C++ Projects/Text Game/screen.h:43: error: 'hConsole' was not declared in this scope
/Users/---/Documents/C++ Projects/Text Game/screen.h:43: error: 'SetConsoleCursorPosition' was not declared in this scope
/Users/---/Documents/C++ Projects/Text Game/screen.h: In function 'int getch()':
/Users/---/Documents/C++ Projects/Text Game/screen.h:56: error: 'cout' was not declared in this scope
/Users/---/Documents/C++ Projects/Text Game/screen.h:56: error: 'flush' was not declared in this scope
/Users/---/Documents/C++ Projects/Text Game/screen.h:57: error: '_getch' was not declared in this scope
/Users/---/Documents/C++ Projects/Text Game/screen.h:58: error: 'HANDLE' was not declared in this scope
/Users/---/Documents/C++ Projects/Text Game/screen.h:58: error: expected `;' before 'hConsole'
/Users/---/Documents/C++ Projects/Text Game/screen.h:59: error: 'hConsole' was not declared in this scope
/Users/---/Documents/C++ Projects/Text Game/screen.h:59: error: 'FlushConsoleInputBuffer' was not declared in this scope
/Users/---/Documents/C++ Projects/Text Game/screen.h: In function 'int getche()':
/Users/---/Documents/C++ Projects/Text Game/screen.h:72: error: '_getche' was not declared in this scope
/Users/---/Documents/C++ Projects/Text Game/screen.h:73: error: 'HANDLE' was not declared in this scope
/Users/---/Documents/C++ Projects/Text Game/screen.h:73: error: expected `;' before 'hConsole'
/Users/---/Documents/C++ Projects/Text Game/screen.h:74: error: 'hConsole' was not declared in this scope
/Users/---/Documents/C++ Projects/Text Game/screen.h:74: error: 'FlushConsoleInputBuffer' was not declared in this scope
In file included from /Users/---/Documents/C++ Projects/Text Game/main.cpp:3:
/Users/---/Documents/C++ Projects/Text Game/screen.h:11:24: error: windows.h: No such file or directory
/Users/---/Documents/C++ Projects/Text Game/screen.h:13:19: error: conio.h: No such file or directory
/Users/---/Documents/C++ Projects/Text Game/screen.h:39: error: 'HANDLE' was not declared in this scope
/Users/---/Documents/C++ Projects/Text Game/screen.h:39: error: expected `;' before 'hConsole'
/Users/---/Documents/C++ Projects/Text Game/screen.h:40: error: 'COORD' was not declared in this scope
/Users/---/Documents/C++ Projects/Text Game/screen.h:40: error: expected `;' before 'point'
/Users/---/Documents/C++ Projects/Text Game/screen.h:41: error: 'point' was not declared in this scope
/Users/---/Documents/C++ Projects/Text Game/screen.h:43: error: 'hConsole' was not declared in this scope
/Users/---/Documents/C++ Projects/Text Game/screen.h:43: error: 'SetConsoleCursorPosition' was not declared in this scope
/Users/---/Documents/C++ Projects/Text Game/screen.h:56: error: 'cout' was not declared in this scope
/Users/---/Documents/C++ Projects/Text Game/screen.h:56: error: 'flush' was not declared in this scope
/Users/---/Documents/C++ Projects/Text Game/screen.h:57: error: '_getch' was not declared in this scope
/Users/---/Documents/C++ Projects/Text Game/screen.h:58: error: 'HANDLE' was not declared in this scope
/Users/---/Documents/C++ Projects/Text Game/screen.h:58: error: expected `;' before 'hConsole'
/Users/---/Documents/C++ Projects/Text Game/screen.h:59: error: 'hConsole' was not declared in this scope
/Users/---/Documents/C++ Projects/Text Game/screen.h:59: error: 'FlushConsoleInputBuffer' was not declared in this scope
/Users/---/Documents/C++ Projects/Text Game/screen.h:72: error: '_getche' was not declared in this scope
/Users/---/Documents/C++ Projects/Text Game/screen.h:73: error: 'HANDLE' was not declared in this scope
/Users/---/Documents/C++ Projects/Text Game/screen.h:73: error: expected `;' before 'hConsole'
/Users/---/Documents/C++ Projects/Text Game/screen.h:74: error: 'hConsole' was not declared in this scope
/Users/---/Documents/C++ Projects/Text Game/screen.h:74: error: 'FlushConsoleInputBuffer' was not declared in this scope
Build failed (21 errors)

I'm not quite sure why it's doing this. I'm sorry if the answer is obvious, I'm very new to this. Tongue

Any help is appreciated. Thanks! Smile

Username removed for privacy reasons.

Comments

Duality's picture
Offline
Joined: 2014 Mar 1

Macintosh Garden isn't really a programming forum, so I don't expect much response to these extremely narrowly scoped programming questions. Stack Overflow is probably better for these sorts of quick questions, even if you're using a vintage compiler.

"windows.h", eh? It seems like you are trying to add a header file for Windows to a Mac OS X 10.4 project. Not sure why!

C++ is very platform dependent, relative to scripting languages like Perl. If you're trying to compile libraries that are written for Linux or Windows but not a Mac... on a Mac, you should be surprised if it can compile at all. Much less run after the fact.

Europa's picture
Offline
Joined: 2018 Nov 19

Macintosh Garden isn't really a programming forum, so I don't expect much response to these extremely narrowly scoped programming questions. Stack Overflow is probably better for these sorts of quick questions, even if you're using a vintage compiler.

Ok, thanks for the tip. Smile

C++ is very platform dependent, relative to scripting languages like Perl. If you're trying to compile libraries that are written for Linux or Windows but not a Mac... on a Mac, you should be surprised if it can compile at all. Much less run after the fact.

Ok, thank you. That makes a lot of sense Smile