|
Archives
D Programming
DD.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 electronics |
c++ - Why does DMC not link this correctly? What am I missing.
This small example program is not working. I have a feeling dmc does not link
header files to there cpp files automaticly. If someone could clue me into
what settings I need to make this test file work that would be sweet. There
are 3 files: main.cpp, mine.h, mine.cpp
CODE::
// main.cpp
//---------------------------------
#include <cstdlib>
#include <iostream>
#include "mine.h"
using namespace std;
int main(int argc, char *argv[])
{
int x = foo();
cout << x << endl;
system("PAUSE");
return EXIT_SUCCESS;
}
//mine.h
//------------------------
#ifndef _MINE_H
#define _MINE_H
int foo();
#endif
// mine.cpp
// ------------------
#include "mine.h"
int foo() {
return 5;
}
I get this error when I try to compile with dmc main.cpp
C:\>dmc main.cpp
link main,,,user32+kernel32/noi;
OPTLINK (R) for Win32 Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved
main.obj(main)
Error 42: Symbol Undefined ?foo YAHXZ (int cdecl foo(void ))
--- errorlevel 1
Feb 06 2007
johnny masters jr skrev:This small example program is not working. I have a feeling dmc does not link header files to there cpp files automaticly. Feb 06 2007
|