www.digitalmars.com         C & C++   DMDScript  

c++ - link error with /co

reply Michael <Michael_member pathlink.com> writes:
I reduce it to the simplest one, but the problem remains.
//test_debug.cpp
#include <cstdio>
int main()
{
printf("Hello world\n");
return 1;
}
//-------------------------------
The file is in "E:\C++\DMwork\Test"
E:\C++\DMwork\Test>dmc -C -g test_debug
the output is:
link test_debug,,,user32+kernel32/co/noi;
OPTLINK : Error 118: Filename Expected 
Path=...
--- errorlevel 1

by the way, the compiler is installed in "E:\DigitalMars" version 8.45, and if
I'd like to debug with windbg, is dmc compatible with it?
Sep 10 2005
parent reply Scott Michel <scottm aero.org> writes:
As far as I can tell (and I've used Windbag (windbg as it's 
affectionately known to the MS developers), DMC's debug info is compatible.

Michael wrote:
 I reduce it to the simplest one, but the problem remains.
 //test_debug.cpp
 #include <cstdio>
 int main()
 {
 printf("Hello world\n");
 return 1;
 }
 //-------------------------------
 The file is in "E:\C++\DMwork\Test"
 E:\C++\DMwork\Test>dmc -C -g test_debug
 the output is:
 link test_debug,,,user32+kernel32/co/noi;
 OPTLINK : Error 118: Filename Expected 
 Path=...
 --- errorlevel 1
 
 by the way, the compiler is installed in "E:\DigitalMars" version 8.45, and if
 I'd like to debug with windbg, is dmc compatible with it?
 
 
Sep 12 2005
parent reply Michael <Michael_member pathlink.com> writes:
In article <dg4g94$24is$1 digitaldaemon.com>, Scott Michel says...
As far as I can tell (and I've used Windbag (windbg as it's 
affectionately known to the MS developers), DMC's debug info is compatible.
Thanks Scott. But as far as I know, windbg needs symbol files(*.pdb) to do source level debug, and it seems that dmc always put debug info together with the exe file.(though I can't even do it now) Would you please tell me how to manage it?
Sep 13 2005
parent reply Scott Michel <scottm aero.org> writes:
Michael wrote:
 In article <dg4g94$24is$1 digitaldaemon.com>, Scott Michel says...
 
As far as I can tell (and I've used Windbag (windbg as it's 
affectionately known to the MS developers), DMC's debug info is compatible.
Thanks Scott. But as far as I know, windbg needs symbol files(*.pdb) to do source level debug, and it seems that dmc always put debug info together with the exe file.(though I can't even do it now) Would you please tell me how to manage it?
Not necessarily. You don't actually need a pdb file to debug a program. In fact, windbg works just fine reading CV symbol information from the executable (/CO/DE flags to the DMC linker.) The pdb file exists to keep debug info separate from the executable, making the MS linker's job "easier" during incremental links.
Sep 13 2005
parent reply Michael <Michael_member pathlink.com> writes:
In article <dg7s14$2i1j$1 digitaldaemon.com>, Scott Michel says...
Not necessarily. You don't actually need a pdb file to debug a program. 
In fact, windbg works just fine reading CV symbol information from the 
executable (/CO/DE flags to the DMC linker.)

The pdb file exists to keep debug info separate from the executable, 
making the MS linker's job "easier" during incremental links.
Thanks, it's really a good news to me. However, what annoys me is that I can't build the programme whenever passing switch /CO to the linker. More specifically dmc -C -g -L/CO/DE aaa.cpp it returns: link aaa,,,user32+kernel32/co/noi/CO/DE; OPTLINK : Error 118: filename expected path=... But, if I drop "-g" and "/CO", it builds well without debug info.
Sep 15 2005
parent reply "Walter Bright" <newshound digitalmars.com> writes:
"Michael" <Michael_member pathlink.com> wrote in message
news:dgc1ur$1b9j$1 digitaldaemon.com...
 Thanks, it's really a good news to me. However, what annoys me is that I
can't
 build the programme whenever passing switch /CO to the linker. More
specifically
 dmc -C -g -L/CO/DE aaa.cpp
 it returns:
 link aaa,,,user32+kernel32/co/noi/CO/DE;
 OPTLINK : Error 118: filename expected
 path=...
 But, if I drop "-g" and "/CO", it builds well without debug info.
When I try it, it works: ------------------------------------------------- C:\cbx>dmc -C -g -L/CO/DE test.cpp link test,,,user32+kernel32/co/noi/CO/DE; C:\cbx> ---------------------------------------------- However, you don't need the -C or the -L/CO/DE switches. Just -g will do fine.
 The file is in "E:\C++\DMwork\Test"
The linker doesn't work well if it encounters "+" in a filename. Try renaming the directory from "C++" to "CPP".
Sep 15 2005
parent reply Michael <Michael_member pathlink.com> writes:
In article <dgcqdh$26ii$1 digitaldaemon.com>, Walter Bright says...
When I try it, it works:
-------------------------------------------------
C:\cbx>dmc -C -g -L/CO/DE test.cpp
link test,,,user32+kernel32/co/noi/CO/DE;

C:\cbx>
----------------------------------------------
However, you don't need the -C or the -L/CO/DE switches. Just -g will do
fine.

 The file is in "E:\C++\DMwork\Test"
The linker doesn't work well if it encounters "+" in a filename. Try renaming the directory from "C++" to "CPP".
I copy the file "test_debug.cpp" to "E:\DigitalMars\" in which dmc is installed, and try "dmc -g test_debug.cpp", however the problem remains. I wonder if the linker can work well when there are some paths containing "+" in the enviroment "PATH" or the linker supports long filenames such as "E:\DigitalMars". Because it can be compiled successfully with "-g", but not linked.
Sep 16 2005
parent reply "Walter Bright" <newshound digitalmars.com> writes:
"Michael" <Michael_member pathlink.com> wrote in message
news:dgeosj$1206$1 digitaldaemon.com...
 I copy the file "test_debug.cpp" to "E:\DigitalMars\" in which dmc is
installed,
 and try "dmc -g test_debug.cpp", however the problem remains. I wonder if
the
 linker can work well when there are some paths containing "+" in the
enviroment
 "PATH" or the linker supports long filenames such as "E:\DigitalMars".
Because
 it can be compiled successfully with "-g", but not linked.
The linker does support long filenames. But the '+' in the PATH needs to go.
Sep 16 2005
parent Michael <Michael_member pathlink.com> writes:
In article <dgf0j1$19hi$1 digitaldaemon.com>, Walter Bright says...
The linker does support long filenames. But the '+' in the PATH needs to go.
Thanks. But it's strange, the PATH does't matter whenever I drop "-g".
Sep 20 2005