×

Loading...

Topic

This topic has been archived. It cannot be replied.
  • 工作学习 / IT杂谈 / 我在编程时又遇到一个问题,专家们,请进。
    我用的是BORLAND C++ 4.0, 编译通过了,但是link时有错:Linking sfnnle~1.exe:
    Linker Warning: No module definition file specified: using defaults
    Linker Error: Undefined symbol OwlMain(int,char far*far*) in library file C:\BC4\LIB\owlwi.lib in module winmain
    请问是什么问题。因为我用的是盗版软件,是不是安装不完全。
    还有,是不是用C++时都要现建立一个project?它有什么用处?
    谢谢!
    • 没人回答,我抛块砖头吧,虽然不是专家
      建议你换VC, 用的人多一些,Borland c++我只用过3.1以下的版本,是在DOS下编程的。你的问题我怀疑是project的设置问题。
      关于project的作用,简单说,比如你要生成一个exe文件,可能需要几个CPP文件,如果没有project, 你可能要一个一个地compile, 然后再link起来,而且link的时候很麻烦,你要1个1个文件名地输入到参数命令行上。有了project file, 你是把这个项目的所有文件作为一个整体来管理的,省事多了。(其实project不只是这样,说复杂了怕你听不明白)
      • 谢谢你的砖头!
        我也搞不清该用VC还是BC,只是觉得应该差不多。我只学过最普通的C,可能属于turbo C吧。只是目前我只有盗版的BC,可能过两天,老师会给我正版的VC。我再试一下。
        我现在放弃了,开始用MATLAB重新编程。因为这个程序是老师给的,是别人编的。索性从头做起。
        谢谢你,另外,你的表达能力很好,应该当老师。
    • I cannot trouble shoot for you. But I suggest you gradually adapt the make file.
      • Anyway, thank you!
      • 请问,怎么设置project?谢谢!
        • 换VC吧。BC早忘光了。
          • VC still need project.
            • 我记得10年前用high C编程不用project, 现在还有人想不用project, 果然少年英雄 ^_^
            • 换了你就知道了。
            • VC is much better than BC. Not many companies use BC for application programming. I know VC project setting, but not BC.
              • BC实在很差,用delphi的控件。一个稍微复杂的程序调进内存就占去10兆。 Delphi的控件里面而且bug多多, 适合小公司做短平快的项目,界面确实不错
                • if u don't use db control. delphi app use much less memory then mfc.better compare before talk.
                  • 不用DB控件, 那不太现实吧,而且BDE巨滥
              • OK, I will try VC next week. Could you please tell me the project setting in VC?Thank you!
                • Create a new project like this....
                  1. open VC
                  2. choose File -->New
                  3. A dialog window appears. Input your project name, location. Choose the type of project you want to build. If you just need to build a dos running project, choose Win32 Console Application. This will create a blank workspace (or you can call it project)
                  4. To add new classes to the workspace, go to workspace window (Alt+0), right click the workspace name and choose New Class. A dialog box will appear. You can just follow the instruction to add new classes. This will also help you to create the class files.
                  • Thanks a lot! I have copied this post . And next week, after I install VC, I will try it.
                  • that's good ,i will read your next message-
                    • what would you like to know?
                      • vc, want to know more.can i ? --------------A Cai Bird
                        • Don't worry, you can master it soon. But first, you have to know what you want. MFC/GUI programming? COM programming? ATL programming? I can recommend some books to you.
              • I installed VC++6.0 this morning and tried the program. But it still had some problems, please help me!Thank you!
                本文发表在 rolia.net 枫下论坛1, I want to know a function that can read the current time of the system, and how to use it. Is it read the seconds or the minutes?In C, it is called biostime().
                2, I built the .exe file and I ran it. The program first just read some parameters as you input them, and also the .dat file name. Please see below:

                1 printf(" Please input learning factor---Et & dEt: (
                Note:0.1>=Et>=0) \n");
                2 scanf("%f",&Et);
                3 scanf("%f",&dEt);

                4 printf(" Please slope value of g() --- alfa:\n");
                5 scanf("%f",&alfa);
                6 printf(" Please input learning factor---beita:\n");
                7 scanf("%f",&beita);
                8 printf(" Please input learning factor---bstep:\n");
                9 printf(" ( Note: 0.1beita>bstep>0.000 ) \n");
                10 scanf("%f",&bstep);

                11 gets(ldfnm);
                12 printf(" Please input learning data file name(iol?.dat):\n");
                13 gets(ldfnm);

                14 sss=fopen(ldfnm,"r");
                15 fscanf(sss,"%d%d",&inputN1,&inputN1);
                16 fscanf(sss,"%d",&modelN);
                17 outputN=62;
                18 position=ftell(sss);
                19 p=position;
                20 fclose(sss);

                So the above part works until line 13, I can input all those parameters. But when I input the .dat file name (line 12 stll works), it stop working. A window jump out and said that
                "Debug assetion failure.
                Program: D:\program\Debug\learning.exe
                File: fscanf.c
                Line: 54
                expression: streams!=NULL"

                Could you please tell what's wrong with the program?
                Thank you very much!更多精彩文章及讨论,请光临枫下论坛 rolia.net
                • 1, time_t time( time_t *timer ). 2, is ldfnm a matrix?
                  • Hi,scorpio, I waited for you last night until 10:00.Where are you? Could you please tell me how to use the time_t time?Thank you very much! BTW, I have solved the second problem.
                    • if u installed VC, u should have MSDN in your computer. you will know the detail after you type "time" at the edit box in "index" page of MSDN.
                      • Yes, I have tried it and solved the problem. Thank you!
                • How to get time.....
                  本文发表在 rolia.net 枫下论坛1. include head file time.h
                  2. time_t will return the time in elapsed seconds since UTC 1/1/70. You can format the return value.
                  3. You can also use COleDateTime class, which has lots of useful functions like GetDay, GetMinute, GetSecond...

                  An example of time_t :
                  /* TIMES.C illustrates various time and date functions including:
                  * time _ftime ctime asctime
                  * localtime gmtime mktime _tzset
                  * _strtime _strdate strftime
                  *
                  * Also the global variable:
                  * _tzname
                  */

                  #include <time.h>
                  #include <stdio.h>
                  #include <sys/types.h>
                  #include <sys/timeb.h>
                  #include <string.h>

                  void main()
                  {
                  char tmpbuf[128], ampm[] = "AM";
                  time_t ltime;
                  struct _timeb tstruct;
                  struct tm *today, *gmt, xmas = { 0, 0, 12, 25, 11, 93 };

                  /* Set time zone from TZ environment variable. If TZ is not set,
                  * the operating system is queried to obtain the default value
                  * for the variable.
                  */
                  _tzset();

                  /* Display operating system-style date and time. */
                  _strtime( tmpbuf );
                  printf( "OS time:\t\t\t\t%s\n", tmpbuf );
                  _strdate( tmpbuf );
                  printf( "OS date:\t\t\t\t%s\n", tmpbuf );

                  /* Get UNIX-style time and display as number and string. */
                  time( &ltime );
                  printf( "Time in seconds since UTC 1/1/70:\t%ld\n", ltime );
                  printf( "UNIX time and date:\t\t\t%s", ctime( &ltime ) );

                  /* Display UTC. */
                  gmt = gmtime( &ltime );
                  printf( "Coordinated universal time:\t\t%s", asctime( gmt ) );

                  /* Convert to time structure and adjust for PM if necessary. */
                  today = localtime( &ltime );
                  if( today->tm_hour > 12 )
                  {
                  strcpy( ampm, "PM" );
                  today->tm_hour -= 12;
                  }
                  if( today->tm_hour == 0 ) /* Adjust if midnight hour. */
                  today->tm_hour = 12;

                  /* Note how pointer addition is used to skip the first 11
                  * characters and printf is used to trim off terminating
                  * characters.
                  */
                  printf( "12-hour time:\t\t\t\t%.8s %s\n",
                  asctime( today ) + 11, ampm );

                  /* Print additional time information. */
                  _ftime( &tstruct );
                  printf( "Plus milliseconds:\t\t\t%u\n", tstruct.millitm );
                  printf( "Zone difference in seconds from UTC:\t%u\n",
                  tstruct.timezone );
                  printf( "Time zone name:\t\t\t\t%s\n", _tzname[0] );
                  printf( "Daylight savings:\t\t\t%s\n",
                  tstruct.dstflag ? "YES" : "NO" );

                  /* Make time for noon on Christmas, 1993. */
                  if( mktime( &xmas ) != (time_t)-1 )
                  printf( "Christmas\t\t\t\t%s\n", asctime( &xmas ) );

                  /* Use time structure to build a customized time string. */
                  today = localtime( &ltime );

                  /* Use strftime to build a customized time string. */
                  strftime( tmpbuf, 128,
                  "Today is %A, day %d of %B in the year %Y.\n", today );
                  printf( tmpbuf );
                  }



                  Output

                  OS time: 21:51:03
                  OS date: 05/03/94
                  Time in seconds since UTC 1/1/70: 768027063
                  UNIX time and date: Tue May 03 21:51:03 1994
                  Coordinated universal time: Wed May 04 04:51:03 1994
                  12-hour time: 09:51:03 PM
                  Plus milliseconds: 279
                  Zone difference in seconds from UTC: 480
                  Time zone name:
                  Daylight savings: YES
                  Christmas Sat Dec 25 12:00:00 1993

                  Today is Tuesday, day 03 of May in the year 1994.更多精彩文章及讨论,请光临枫下论坛 rolia.net
                  • Thanks a lot!!
    • I think you can write a makefile, that's much better
      • what means makefile?
        • Makefile is text format .mk file, which is composed of compile and link options, and conditions, and run with nmake.exe