www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

c++ - I am stuck :(

↑ ↓ ← "Yeric" <REMOVEamigabloke yahoo.co.ukREMOVE> writes:
Hi all,
I am fairly new to DMC and C++, and I a experiencing problems trying to
compile a simple hello.cpp program from \dm\stlport\hello.cpp

I followed the intructions from the readme.txt to build the stlport libaries
and dlls, xcopied them as per instructions and am able to compile from
command line ok.

I am running WinXP ( so not sure if this is a problem or not ? )

I start the SCW32mn.exe and get the IDDE up and running.

I then create a new dos project and add the hello.cpp file

Try to build it and get this error

sc hello.cpp -ms -C -S -3 -a2 -c -gf -ohello.obj
Fatal Error: O:\DM_FILES\hello.cpp(1): unable to open input file 'iostream'
Lines Processed: 1  Errors: 1  Warnings: 0
Build failed

Hmm a bit odd really, since I have included ..\stlport\stlport in the sc.ini
file in the include path

Any help appreciated
Yeric
Jul 31 2003
"Greg Peet" <admin gregpeet.com> writes:
"Yeric" <REMOVEamigabloke yahoo.co.ukREMOVE> wrote in message
news:bgc8tn$2180$1 digitaldaemon.com...
| I start the SCW32mn.exe and get the IDDE up and running.
Why are you using SCW32mn.exe? I haven't used this version of the IDDE, I
use SCW32.exe and it runs fine on XP
Jul 31 2003
↑ ↓ "Greg Peet" <admin gregpeet.com> writes:
Sorry sent my message too soon...coffee makes you hit keyboard shortcuts
before needed...

You say that you successfully built stlport so, hmm. Are you including
"C:\dm\stlport\stlport" before the normal include?

Like:
INCLUDE="C:\dm\stlport\stlport";"% P%\..\include";"% P%\..\mfc\include";"% P
%\..\stl";%INCLUDE%

I had some trouble with the environmental variables version of the STLPort
path (but I didn't give it much time, I was hasty). I have this setup and it
works for me.

"Greg Peet" <admin gregpeet.com> wrote in message
news:bgccum$24vg$1 digitaldaemon.com...
| "Yeric" <REMOVEamigabloke yahoo.co.ukREMOVE> wrote in message
| news:bgc8tn$2180$1 digitaldaemon.com...
| | I start the SCW32mn.exe and get the IDDE up and running.
| Why are you using SCW32mn.exe? I haven't used this version of the IDDE, I
| use SCW32.exe and it runs fine on XP
|
|
Jul 31 2003
↑ ↓ → Yeric < REMOVE AmigaBloke yahoo.co.uk REMOVE> writes:
Greg Peet wrote:

 Sorry sent my message too soon...coffee makes you hit keyboard shortcuts
 before needed...

I know that feeling <g>
 
 You say that you successfully built stlport so, hmm. Are you including
 "C:\dm\stlport\stlport" before the normal include?

Well I am including this in the sc.ini file exactly as per readme
 
 Like:

 %\..\stl";%INCLUDE%
 
 I had some trouble with the environmental variables version of the STLPort
 path (but I didn't give it much time, I was hasty). I have this setup and
 it works for me.

I am now using the SCW32 also now but it still doesn't work :( I copied the dll and .lib files to the \dm\lib dir, the only thing I ave not done yet is reboted my machine, should I need to ?? I am going to play a bit more with it, for the moment the command line will suffice, but hopefully soon the IDDE will be most useful Thanks Yeric
Aug 01 2003
Arjan Knepper <arjan ask.me> writes:
Yeric wrote:
 Hi all,
 I am fairly new to DMC and C++, and I a experiencing problems trying to
 compile a simple hello.cpp program from \dm\stlport\hello.cpp
 
 I am running WinXP ( so not sure if this is a problem or not ? )

No should not be a problem.
 I start the SCW32mn.exe and get the IDDE up and running.

With SCW32MN.EXE you are able to start the idde more than once. Might be handy when working on more than one project at the same time
 I then create a new dos project and add the hello.cpp file

This is the problem I guess. You should not create a 'dos' project but a 'Windows NT console'. In the project window use the ARROW KEYS to select the target type. Also take a good look at sc.ini in the compiler bin drectory and make sure the settings are correct. Arjan
Jul 31 2003
↑ ↓ → "Yeric" <REMOVEamigabloke yahoo.co.ukREMOVE> writes:
 This is the problem I guess. You should not create a 'dos' project but a
 'Windows NT console'. In the project window use the ARROW KEYS to select
 the target type.

Ok done this and when it loads the project I get this Parsing ..\dm\stlport\hello.cpp Warning: O:\dm\stlport\stlport\config\stl_apple.h(33): Encountered preprocessor #error directive Warning: O:\dm\stlport\stlport\config\stl_apple.h(41): Encountered preprocessor #error directive Warning: O:\dm\stlport\stlport\cstddef(35): Invalid include file name: _STLP_NATIVE_C_HEADER(stddef.h) Warning: O:\dm\stlport\stlport\cwchar(49): Invalid include file name: _STLP_NATIVE_C_HEADER(wchar.h) Warning: O:\dm\stlport\stlport\cstring(27): Invalid include file name: _STLP_NATIVE_C_HEADER(string.h) Warning: O:\dm\stlport\stlport\exception(49): Invalid include file name: _STLP_NATIVE_CPP_RUNTIME_HEADER(Exception.h) Warning: O:\dm\stlport\stlport\cstdlib(27): Invalid include file name: _STLP_NATIVE_C_HEADER(stdlib.h) Warning: O:\dm\stlport\stlport\stdarg.h(23): Invalid include file name: _STLP_NATIVE_C_HEADER(stdarg.h) Warning: O:\dm\stlport\stlport\ctype.h(23): Invalid include file name: _STLP_NATIVE_C_HEADER(ctype.h) Warning: O:\dm\stlport\stlport\string.h(24): Invalid include file name: _STLP_NATIVE_C_HEADER(string.h) Warning: O:\dm\stlport\stlport\stdlib.h(23): Invalid include file name: _STLP_NATIVE_C_HEADER(stdlib.h) Warning: O:\dm\stlport\stlport\new.h(31): Invalid include file name: _STLP_NATIVE_CPP_RUNTIME_HEADER(new.h) Warning: O:\dm\stlport\stlport\cstdio(31): Invalid include file name: _STLP_NATIVE_C_HEADER(stdio.h) Warning: O:\dm\stlport\stlport\cfloat(29): Invalid include file name: _STLP_NATIVE_C_HEADER(float.h) Warning: O:\DM\STLPORT\hello.cpp(3): Semicolon expected Parse Completed No errors :) but then I try and build and get this sc ..\DM\STLPORT\hello.cpp -mn -o+time -WA -3 -a8 -c -o..\DM\STLPORT\hello.obj link /NOI /DE /E /PACKF /XN /NT /ENTRY:WinMainCRTStartup /BAS:4194304 /A:512 Hello.LNK Error: O:\DM\BIN\..\lib\SNN.lib(winstart) (1): Symbol Undefined _WinMain 16 Lines Processed: 16348 Errors: 1 Warnings: 0 Build failed
 Also take a good look at sc.ini in the compiler bin drectory and make
 sure the settings are correct.

And here is my sc.ini file [Version] version=7.51 Build 020 [Environment] PATH=%PATH%;"% P%\..\bin" BIN="% P%\..\bin" INCLUDE="% P%\..\stlport\stlport";"% P%\..\include";"% P%\..\mfc\include";"% P%\..\stl";%INCLUDE% LIB="% P%\..\lib";"% P%\..\mfc\lib";%LIB% HELP="% P%\..\help" And the source file #include <iostream> using namespace std ; int main( void ) { cout << "Hello world!" << endl ; } Well for many hours now I have been battling with this one If I change the <iostream> and append .h it works fine !! This denotes a problem somewhere with my stlport configuration or does it ?since dmc hello -I\dm\stlport\stlport \dm\lib\stlp45dms.lib -D_DLL works fine no errors If I use sc instead of dmc I get this *** Unrecognized Command *** DESCRIPTION: SC is a command line program used for communicating with the NT Service Controller and services. USAGE: sc <server> [command] [service name] <option1> <option2>... The option <server> has the form "\\ServerName" Further help on commands can be obtained by typing: "sc [command]" Commands: query-----------Queries the status for a service, or enumerates the status for types of services. queryex---------Queries the extended status for a service, or enumerates the status for types of services. start-----------Starts a service. pause-----------Sends a PAUSE control request to a service. interrogate-----Sends an INTERROGATE control request to a service. continue--------Sends a CONTINUE control request to a service. stop------------Sends a STOP request to a service. config----------Changes the configuration of a service (persistant). description-----Changes the description of a service. failure---------Changes the actions taken by a service upon failure. qc--------------Queries the configuration information for a service. qdescription----Queries the description for a service. qfailure--------Queries the actions taken by a service upon failure. delete----------Deletes a service (from the registry). create----------Creates a service. (adds it to the registry). control---------Sends a control to a service. sdshow----------Displays a service's security descriptor. sdset-----------Sets a service's security descriptor. GetDisplayName--Gets the DisplayName for a service. GetKeyName------Gets the ServiceKeyName for a service. EnumDepend------Enumerates Service Dependencies. The following commands don't require a service name: sc <server> <command> <option> boot------------(ok | bad) Indicates whether the last boot should be saved as the last-known-good boot configuration Lock------------Locks the Service Database QueryLock-------Queries the LockStatus for the SCManager Database EXAMPLE: sc start MyService Would you like to see help for the QUERY and QUERYEX commands? [ y | n ]: QUERY and QUERYEX OPTIONS : If the query command is followed by a service name, the status for that service is returned. Further options do not apply in this case. If the query command is followed by nothing or one of the options listed below, the services are enumerated. type= Type of services to enumerate (driver, service, all) (default = service) state= State of services to enumerate (inactive, all) (default = active) bufsize= The size (in bytes) of the enumeration buffer (default = 4096) ri= The resume index number at which to begin the enumeration (default = 0) group= Service group to enumerate (default = all groups) SYNTAX EXAMPLES sc query - Enumerates status for active services & drivers sc query messenger - Displays status for the messenger service sc queryex messenger - Displays extended status for the messenger service sc query type= driver - Enumerates only active drivers sc query type= service - Enumerates only Win32 services sc query state= all - Enumerates all services & drivers sc query bufsize= 50 - Enumerates with a 50 byte buffer. sc query ri= 14 - Enumerates with resume index = 14 sc queryex group= "" - Enumerates active services not in a group sc query type= service type= interact - Enumerates all interactive services sc query type= driver group= NDIS - Enumerates all NDIS drivers Now I am totaly confused stuck and frustrating What have I done wrong ??? Start SCW32 Project->new Hello.prj > Win NT Add hello.cpp file moans about some HELLO_DEF not added add anyway, I click no but it adds it anyway Makes no difference if it is in the project or not same compile error build generates this file all the time new.h the contents of /* Copyright (C) 1986-2001 by Digital Mars. $Revision: 1.1.1.1 $ */ #if __SC__ || __RCC__ #pragma once #endif #ifndef __NEW_H #define __NEW_H 1 /* Define _CRTAPI1 (for compatibility with the NT SDK) */ #ifndef _CRTAPI1 #define _CRTAPI1 __cdecl #endif /* Define _CRTAPI2 (for compatibility with the NT SDK) */ #ifndef _CRTAPI2 #define _CRTAPI2 __cdecl #endif /* Define CRTIMP */ #ifndef _CRTIMP #if defined(_WIN32) && defined(_DLL) #define _CRTIMP __declspec(dllimport) #else #define _CRTIMP #endif #endif extern "C++" { #if !defined(__NEW_DEFINED) #define __NEW_DEFINED 1 void *operator new(unsigned, void *p); #if _ENABLE_ARRAYNEW void *operator new[](unsigned, void *p); #endif #endif typedef int (__cdecl * _PNH)( unsigned ); //for Microsoft compatibility typedef void (* PFVV)(); //as defined in ARM _PNH __cdecl _set_new_handler(_PNH); //for Microsoft compatibility PFVV set_new_handler(PFVV); //as defined in ARM } #endif Is there some other .ini file I need to be poking at ?? Any help appreciated Please Yeric
Aug 01 2003
"Yeric" <REMOVEamigabloke yahoo.co.ukREMOVE> writes:
Ok I gave up in the end !!

Deleted Path from environemt
Deleted dm

Xcopied from CD again

Built stlport again!!

copied to \dm\lib *.lib and *.dll

opened project created an empty WIN NT console app used <iostream> and using
namespace std ;

et voilla it compiled without a qualm

how odd is this ??

the only thing it moans about is when I reopen the project and it parses the
files, it gives loads of warnings about the stlport .h files, but will still
compile ok :)

However this I do not understand at all

dmc hello -I\dm\stlport\stlport \dm\lib\stlp45dms.lib -D_DLL = 34kb
run from command line

so I decided to do a bit of experimenting and edited the sc.ini file, lib
path and preceeded the first entry with this

\..\lib\stlp45dms.lib -D_DLL

thinking that this might have something to do with the .exe size but it
doesn't, actually it increases the size by a few kb.

So I try building it as a dos exe, and dos com but they fail on the build
something to do with the stlport libraries.

So can anyone tell me why there is such a difference in size between the
command line compiled version and the IDDE version please ?

Does anyone know a way to other than setting optimizations for space or
size, how to reduce exe size

Ilya Minkov in one of my previous posts suggested this from the command line

dmc hello.cpp -Nc -6 -o

but how to pass such arguments to IDDE ??? The make file somewhere ???

Thanks in advance for your patience and help on this
Yeric
Aug 01 2003
↑ ↓ Arjan Knepper <arjan ask.me> writes:
Yeric wrote:
 However this I do not understand at all
 
 dmc hello -I\dm\stlport\stlport \dm\lib\stlp45dms.lib -D_DLL = 34kb
 run from command line
 
 so I decided to do a bit of experimenting and edited the sc.ini file, lib
 path and preceeded the first entry with this
 
 \..\lib\stlp45dms.lib -D_DLL
 
 thinking that this might have something to do with the .exe size but it
 doesn't, actually it increases the size by a few kb.

Adding static libs or import libs to link against should be done in the IDDE: right click the project -> click 'settings...' -> click on the 'directories' tab. At 'Library Directories' add the direcory path for the libs you want to use seperate them with ; Click OK right click the project -> click 'Edit Project...' type the lib name and extension in the 'file name' edit control click on 'Add'. repeat for all libs you want to add to the project, don;t forget to click on OK.
 So I try building it as a dos exe, and dos com but they fail on the build
 something to do with the stlport libraries.
 
 So can anyone tell me why there is such a difference in size between the
 command line compiled version and the IDDE version please ?

You use different comilation options??
 Does anyone know a way to other than setting optimizations for space or
 size, how to reduce exe size
 
 Ilya Minkov in one of my previous posts suggested this from the command line
 
 dmc hello.cpp -Nc -6 -o
 
 but how to pass such arguments to IDDE ??? The make file somewhere ???

-Nc is function level link: right click project -> 'Settings...' -> 'Build' tab -> 'Compiler -> Code Generation' -6 is not supported in the idde, but you mat set this in the sc.ini file Modify the CFLAGS and/or CFLAG= entry add -6 Arjan
Aug 02 2003
↑ ↓ → Yeric < REMOVE AmigaBloke yahoo.co.uk REMOVE> writes:
 Adding static libs or import libs to link against should be done in the
 IDDE: right click the project -> click 'settings...' -> click on the
 'directories' tab. At 'Library Directories' add the direcory path for
 the libs you want to use seperate them with ;
 Click OK
 right click the project -> click 'Edit Project...' type the lib name and
   extension in the 'file name' edit control click on 'Add'.
 repeat for all libs you want to add to the project, don;t forget to
 click on OK.
 

Ok thanks for the tips :) I am still in the middle of reading the IDDE help files
 

 You use different comilation options??

Yes they are very different more options with the IDDE and none with the command line.
 -Nc is function level link:



Generation' -6 is not supported in the idde, but you mat set this in the sc.ini file Modify the CFLAGS and/or CFLAG= entry add -6

thank you again for your tips I am not used to using and ide yet, everything I have done in the past has been with GCC via mingw32 comand line and basic make file Thanks Yeric
Aug 02 2003