Author Topic: Problem compiling with DM/STLport  (Read 6910 times)

Priit

  • Guest
Problem compiling with DM/STLport
« on: August 01, 2005, 10:42:05 am »
Code
#include <iostream>

using namespace std;

int main (int argc, char *argv[])
{
cout << "Hello World!" << endl;
cout << "Press ENTER to continue..." << endl;
cin.get();
return 0;
}

It won't compile, when used Digitalmars compiler (v843) with Codeblocks, but it will compile when used dm in command line.

Error i get:
Code
Project   : Console application
Compiler  : Digital Mars Compiler (called directly)
Directory : C:\Documents and Settings\Priit\Desktop\
--------------------------------------------------------------------------------
Switching to target: default
dmc.exe -mn -c       -I"C:\dm\include" -o.objs\main.obj mrain.cpp
C:\dm\bin\..\stlport\stlport\stl/_alloc.h(134) : Error: undefined identifier '__stl_new'
C:\dm\bin\..\stlport\stlport\stl/_alloc.h(135) : Error: undefined identifier '__stl_delete'
class _STLP_CLASS_DECLSPEC __Named_exception : public _STLP_EXCEPTION_BASE {
                                                                           ^
C:\dm\bin\..\stlport\stlport\stdexcept(56) : Error: identifier expected
--- errorlevel 1
Process terminated with status 1 (0 minutes, 1 seconds)
3 errors, 0 warnings
 

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Problem compiling with DM/STLport
« Reply #1 on: August 01, 2005, 11:02:55 am »
edit your sc.ini so that it contains the pathes to your stlport includes and libs directories.

Priit

  • Guest
Re: Problem compiling with DM/STLport
« Reply #2 on: August 01, 2005, 12:36:26 pm »
edit your sc.ini so that it contains the pathes to your stlport includes and libs directories.

I think i allready did that. Anyway here's my sc.ini:

Code
[Version]
version=7.51 Build 020

[Environment]
PATH=%PATH%;"%@P%\..\bin"
BIN="%@P%\..\bin"
INCLUDE="%@P%\..\stlport\stlport";"%@P%\..\include";"%@P%\..\mfc\include";%INCLUDE%
LIB="%@P%\..\lib";"%@P%\..\mfc\lib";%LIB%
HELP="%@P%\..\help"



Sorry for posting into wrong thread at the first place :)

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Problem compiling with DM/STLport
« Reply #3 on: August 01, 2005, 12:46:56 pm »
I haven't worked with DM much, but are you sure it's using sc.ini when invoked by C::B?
If I were you, I would add the above directories in the global directories option for the DM compiler...

Yiannis.
Be patient!
This bug will be fixed soon...

Priit

  • Guest
Re: Problem compiling with DM/STLport
« Reply #4 on: August 01, 2005, 01:17:55 pm »
I added C:\dm\stlport\stlport directory to DM compiler global directories (Compile-Compiler Options-Digital Mars Compiler-Directories-Compiler) and it works, but C:\dm\stlport\stlport has to be before  \dm\include. Otherwise i get the same error mentioned above.

Thank you

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: Problem compiling with DM/STLport
« Reply #5 on: August 01, 2005, 01:25:23 pm »
Quote from: mandrav
I haven't worked with DM much, but are you sure it's using sc.ini when invoked by C::B?
yes it does for sure! i use it this way and don't have any problems

Quote from: mandrav
If I were you, I would add the above directories in the global directories option for the DM compiler...
works just as well of course,
in addition it gives more flexibility, if using other stl libraries,
but in fact, when one uses DMC, stlport is the only one which works for now with
reasonably less troubles ...  :)



Quote from: Prjit
Quote from: tiwag
edit your sc.ini so that it contains the pathes to your stlport includes and libs directories.

I think i allready did that...

i use the absolute path to the stlport library and it works like a charm

here's my sc.ini:
Code
[Version]
version=7.51 Build 020

[Environment]
PATH=%PATH%;"%@P%\..\bin"
BIN="%@P%\..\bin"
INCLUDE="D:\dm\stlport\stlport";"%@P%\..\include";"%@P%\..\mfc\include";%INCLUDE%
LIB="%@P%\..\lib";"%@P%\..\mfc\lib";%LIB%
HELP="%@P%\..\help"


result:
Code
Project   : Console application
Compiler  : Digital Mars Compiler (called directly)
Directory : D:\cpp\_projects\dm\hello_stlport\
--------------------------------------------------------------------------------
Switching to target: default
dmc.exe -mn -c       -I"D:\dm\include" -o.objs\hello.o hello.cpp
link.exe /NOLOGO    .objs\hello.o , "D:\cpp\_projects\dm\hello_stlport\hello_stlport.exe", ,  
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings



codeblocks project file:
Code
<?xml version="1.0"?>
<!DOCTYPE Code::Blocks_project_file>
<Code::Blocks_project_file>
<FileVersion major="1" minor="1"/>
<Project>
<Option title="Console application"/>
<Option makefile="Makefile"/>
<Option makefile_is_custom="0"/>
<Option compiler="3"/>
<Build>
<Target title="default">
<Option output="D:\cpp\_projects\dm\hello_stlport\hello_stlport.exe"/>
<Option working_dir="."/>
<Option object_output=".objs"/>
<Option deps_output=".deps"/>
<Option external_deps=""/>
<Option additional_depfiles=""/>
<Option type="1"/>
<Option compiler="3"/>
<Option projectResourceIncludeDirsRelation="1"/>
</Target>
</Build>
<Unit filename="hello.cpp">
<Option compilerVar="CPP"/>
<Option objectName="hello.o"/>
<Option target="default"/>
</Unit>
</Project>
</Code::Blocks_project_file>

you see, you dont need any include directories or anything else,
just add the module-file ( in this case "hello.cpp" ) to the project.

that's it !


HTH -tiwag

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: Problem compiling with DM/STLport
« Reply #6 on: August 02, 2005, 09:05:12 am »
I added C:\dm\stlport\stlport directory to DM compiler global directories (Compile-Compiler Options-Digital Mars Compiler-Directories-Compiler) and it works, but C:\dm\stlport\stlport has to be before  \dm\include. Otherwise i get the same error mentioned above.

Priit, you are absolutely right ! - that's the real important thing - when using stlport, the include-path to the "dm\stlport\stlport" directory MUST BE at first position, because in the standard include directory "dm\include" another instance of "iostream.h" resides and this is referenced by "iostream". If "dm\stlport\stlport" is not the first search location for include files, the wrong "iostream.h" file is included.

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: Problem compiling with DM/STLport
« Reply #7 on: November 02, 2005, 09:13:53 pm »
I added C:\dm\stlport\stlport directory to DM compiler global directories (Compile-Compiler Options-Digital Mars Compiler-Directories-Compiler) and it works, but C:\dm\stlport\stlport has to be before  \dm\include. Otherwise i get the same error mentioned above.

Thank you

This is absolutely correct.

Yiannis,
Maybe during the check for the presence of the digital mars compiler we should also check for the presence of the stlport, since this is rather important for usin good c++/stl.

Can you pintpoint me the correct code files where the digital mars compiler is detected, maybe I can add this stl port detection.

kind regards,
Lieven


Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Problem compiling with DM/STLport
« Reply #8 on: November 02, 2005, 09:43:02 pm »
Quote
Can you pintpoint me the correct code files where the digital mars compiler is detected, maybe I can add this stl port detection.

Sure, it's in plugins/compilergcc/compilerDMC.cpp. Check the function AutoDetectInstallationDir(). You might want to take a peek at other compilers too, since they each have a similar function...
FYI, DMC is not actually "auto-detected", just the default installation directories are used. IIRC I couldn't find a way to auto-detect it (registry, ini file, etc).
Be patient!
This bug will be fixed soon...

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: Problem compiling with DM/STLport
« Reply #9 on: November 02, 2005, 09:49:04 pm »
done ... check your ...