我爱builder

C++Builder 程序员博客

  如题,我先用2007编译,在工程中调用的时候没有出现工程的界面,而是出现了cpu信息。我又用c++builde6实验了一下,报的是未找到.obj。
  请问错在哪里!!

你的问题是怎么生成DLL,还是怎么调用DLL?
这两个问题在CSDN上有很多.你可先搜一下.

  • Filed under: C++ Builder
  • 编译中~~一觉醒来还在编译中~~逛会论坛先~~!

    这就是我放弃BCB中的一个致命硬伤之一

    http://andy.jgknet.de/cpp/ 这里下载bcb编辑加速插件

    http://andy.jgknet.de/dspeedup/ 这个是IDE的加速

    换个角度想一下,其实慢也好,你可以多一分钟的休息时间,呵呵

    你用的是BCB6吗?

    端一杯咖啡,去看个网页,回来一看,不错,好了!!!

    其实速度没有传说中的慢吧,感觉Vc也快不到哪里去!

    我用了加速插件,快了N倍。DelphiSpeedup.zip加快IDE速度,bcc32pchSetup.exe加快编译器速度。很好用的。

    该回复于2008-07-10 02:37:00被版主删除

  • Filed under: C++ Builder
  • 给工程添加一个空unit(XXX.h和XXX.cpp),由于工程的所有的结构都定义在一个头文件(xx_Common.h)里面,添加unit 后,工程编译没有错误,但是在xxx.h添加下列代码时竟然出现了26个错误:
    #include "xx_Common.h"

    通过c++builder 6查看这些错语时,都指向这xx_Common.h中的前三个结构中的String 类型的字段,但是xx_Common.h还有很多其他的结构体也用String。错误码如下:

    [C++ Warning] FormSnmp.cpp(138): W8012 Comparing signed and unsigned values
      [C++ Warning] FormSnmp.cpp(196): W8012 Comparing signed and unsigned values
      [C++ Warning] FormSnmp.cpp(229): W8012 Comparing signed and unsigned values
      [C++ Warning] FormSnmp.cpp(282): W8012 Comparing signed and unsigned values
      [C++ Warning] FormSnmp.cpp(532): W8012 Comparing signed and unsigned values
      [C++ Warning] FormSnmp.cpp(1025): W8012 Comparing signed and unsigned values
      [C++ Warning] FormConf.cpp(95): W8018 Assigning int to TColor
      [C++ Error] AC_Common.h(82): E2141 Declaration syntax error
      [C++ Error] AC_Common.h(86): E2303 Type name expected
      [C++ Error] AC_Common.h(86): E2139 Declaration missing ;
      [C++ Error] AC_Common.h(87): E2303 Type name expected
      [C++ Error] AC_Common.h(87): E2238 Multiple declaration for 'VBItem::String'
      [C++ Error] AC_Common.h(86): E2344 Earlier declaration of 'VBItem::String'
      [C++ Error] AC_Common.h(87): E2139 Declaration missing ;
      [C++ Error] AC_Common.h(94): E2303 Type name expected
      [C++ Error] AC_Common.h(94): E2139 Declaration missing ;
      [C++ Error] AC_Common.h(105): E2303 Type name expected
      [C++ Error] AC_Common.h(105): E2139 Declaration missing ;
      [C++ Error] AC_Common.h(107): E2303 Type name expected
      [C++ Error] AC_Common.h(107): E2238 Multiple declaration for 'TrapMsg::String'
      [C++ Error] AC_Common.h(105): E2344 Earlier declaration of 'TrapMsg::String'
      [C++ Error] AC_Common.h(107): E2139 Declaration missing ;
      [C++ Error] AC_Common.h(108): E2303 Type name expected
      [C++ Error] AC_Common.h(108): E2238 Multiple declaration for 'TrapMsg::String'
      [C++ Error] AC_Common.h(107): E2344 Earlier declaration of 'TrapMsg::String'
      [C++ Error] AC_Common.h(108): E2139 Declaration missing ;
      [C++ Error] AC_Common.h(113): E2303 Type name expected
      [C++ Error] AC_Common.h(113): E2238 Multiple declaration for 'TrapMsg::String'
      [C++ Error] AC_Common.h(108): E2344 Earlier declaration of 'TrapMsg::String'
      [C++ Error] AC_Common.h(113): E2139 Declaration missing ;
      [C++ Error] AC_Common.h(114): E2303 Type name expected
      [C++ Error] AC_Common.h(114): E2238 Multiple declaration for 'TrapMsg::String'
      [C++ Error] AC_Common.h(114): E2228 Too many error or warning messages

    String 本身是系统定义的类

    还有你是否使用
    #ifndef Unit1H
    #define Unit1H

    #endif

    之类的代码防止重复定义?

    在新建的Unit
    #include <vcl.h>
    试试

    没有使用
    #ifndef Unit1H
    #define Unit1H

    #endif

    我原计划用这个UNIT建一个新类的,所以改了自己定义的宏。

    VC也要 #if  #define 的,C++类的标准定义啊

    当然啊,这只是个好的习惯而以,刚加了个VCL.H后就没有错了,一般的ACL库的东西难道还需要另外引入相关头文件?

    BCB使用是VCL库

    当我在这个空的unit添加如下代码:
    //—————————————————————————

    #ifndef DISPLAY_SNMP_H
    #define DISPLAY_SNMP_H
    //—————————————————————————
    #include <vcl.h>
    #include "AC_Common.h"
    #include <vector>
    using namespace std;

    class TDisplaySnmp
    {
        //Constructor
    public:
        __fastcall TDisplaySnmp(const TStringGrid &SGdsSnmp);

        //Operations
    public:
        void __fastcall Display(const vector <VBItem> &vVBList,const int &nRecvCnt,int nTotalCols);

        //Attributes
    protected:
        //TStringGrid *pSGdsSnmp;              //用于显示数据用的字符串表格控件

    };

    #endif

    实现文件里面的函数全是空的,没有添加任何代码,在编译的时候出现这样的错误:
      [C++ Error] DisplaySnmp.h(18): E2293 ) expected
      [C++ Error] DisplaySnmp.h(25): E2321 Declaration does not specify a tag or an identifier
      [C++ Error] DisplaySnmp.cpp(13): E2293 ) expected

    但是不使用TStringGrid的参数和变量时,就没有错误,不知道是为什么?

    C++ BUILDER在帮助文档、调试、错误提示和定位方面,与VC相比,真的还有一大段的路要走啊。

    #include "xx_Common.h"这个应该放在XXX.cpp里的哦

      TStringGrid要用#include  <Grids.hpp> 

    加上就好了,C++BUILDER的帮助文件怎么就不清楚地说明呢,非得要去网上找才知道。谢谢各位啦。

    TStringGrid represents a grid control designed to simplify the handling of strings and associated objects.

    Unit

    grids

    这里的 grids 就是那个 hpp 头文件了,你还没有习惯而已

    TForm represents a standard application window (form).
    Unit
    forms
    也是一样需要 include <forms.hpp>

    去掉VCL库

    在窗体上放一个TStringGrid ,你就会发现已经自动包含了 <Grids.hpp>  。cb的提示有时候不是很明白,做多了你就会知道了。

    该回复于2008-07-10 02:40:16被版主删除

    该回复于2008-07-10 02:47:35被版主删除

    该回复于2008-07-19 16:09:47被版主删除

  • Filed under: C++ Builder
  • 用 BCB6 编译了盒子上下载的 4.98,但在使用时提示【[C++ Error] WinSkinData.hpp(289): E2293 ) expected】

    这一行是 void __fastcall ReadColor2(TShemeColor item, AnsiString key, Graphics::TColor default);

    是否是 TShemeColor 未定义?还是 Graphics::TColor 这个不对??怎么修改??

    不清楚你下载的那个版本文件是否完整,我手头的这份安装和使用都没有问题。不过由于涉及版权问题,不能在网站上共享了。

    看提示应该是TShemeColor类型的定义没有找到。

    恩,,好像我的也是噢,,没有解决噢,不知道怎么解决好噢,,

    我也在盒子下了個用,不過我用B2007編譯,記憶中一帆風順的,沒出什麼問題。 

    expected 這樣的提示,也太不明確原因是什麼發。
    或許需要你重新啟動後再編譯試試看。因為可能是編譯器或IDE本身出了異常。

  • Filed under: C++ Builder
  • Delphi有一个MiniDExe工程和KOL都可以编译出极小的EXE,但是在研究BCB过程中没有找到如何减小EXE文件大小的方法,看了这篇文章:
    http://topic.csdn.net/u/20080628/15/69A98C60-6E6E-49CE-BAC8-0C22280648C3.html
    发现VC的可配置参数比BCB多,BCB的连接程序基本没有多余的参数可以使用,有谁研究过相关的问题吗?

    顶,偶也想知道

    我也来顶一下,现在就是为了把一个DLL改小,只好用SDK重写编译了。SDK编译出来的程序不用设置就很小。

    不用VCL

    不用VCL、不用C运行库,自己指定入口点。
    基本上就已经很小了。

    不用VCL
    要做界面用资源文件做……
    汗,ms这样bcb便没有优势了,还不如用vc算了

    引用 6 楼 JeffChung 的回复:
    不用VCL
    要做界面用资源文件做……
    汗,ms这样bcb便没有优势了,还不如用vc算了

    VC用了MFC也小不到哪去

    引用 5 楼 akirya 的回复:
    不用VCL、不用C运行库,自己指定入口点。
    基本上就已经很小了。

    比汇编还小

    不用C运行库,工程大一点的话改起来还是很麻烦的

    现在客户的机器都是几十到几百G。。。

    难道谁的项目能达到10G

    Vista操作系统也没有这么多吧?

    :-)

    只是为了研究而已,没有人会真的这样写项目,但是研究一下也不错,至少能知道BCB能不能这样做哈!

    akirya:
    BCB可以设置成不用VCL,不用C运行库,但是ilink32没有指定入口的选项吧,或者我没找到

    #pragma comment(linker, "/ENTRY:main")

    顶顶,想要exe,dll减小体积可以用脱壳软件压缩。

    BCB我最小可以编译50K的,SDK.VC却可以编译成1K的.

    引用 10 楼 jxw1987628 的回复:
    现在客户的机器都是几十到几百G。。。

    难道谁的项目能达到10G

    Vista操作系统也没有这么多吧?

    :-)


    顶小漫

    顶,偶也想知道

    完成后,用NSPACK压缩,最少都可以省60%空间。

    嘿,有的也告诉俺一声。要想做出体积小的,最好别用BCB

    用BCB就不要考慮體積問題啦,想嬌小玲瓏,用VC。
    快速解決問題才是用BCB的正道。

    要写很小的程序可以考虑用Win32 汇编

    引用 8 楼 My_Love 的回复:
    引用 5 楼 akirya 的回复:
    不用VCL、不用C运行库,自己指定入口点。
    基本上就已经很小了。

    比汇编还小


    没可能的吧
    汇编可是最低级的语言
    比他小,它就可以消失了

    关注一下,呵呵

    没多大意思!

  • Filed under: C++ Builder
  • 从网上刚下载的2CD的bcb 6.0版,安装后编译程序时均报错:[Linker Fatal Error] Fatal: Expected a file name:
    请各位大侠帮帮忙,是什么问题?

    没有中文名称。

    是不是所有的工程都这样?
    重装一次试试看

    MARK

    打开BCB后不作任何操作直接编译Project1 ,如果也出错就是没装好,或安装文件不行

    估计是目录错误或者文件缺失

  • Filed under: C++ Builder
  • 1文件NestedText.cpp
    #include "nested.h"
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <assert.h>
    main(int argc,char** argv){
      // stack textlines;
      File* file;
      char* s;
      #define BUFSIZE 100
      char buf[BUFSIZE];
      assert(argc==2);//File name is argument
      textlines.initialize();
      file=fopen(argv[1],"r");
      assert(file);
      //Read File and store lines in the stack:
      while(fget(buf,BUFSIZE,file)){
            char* string =(char*)malloc(strlen(buf)+1);
            assert(string);
            strcop(string,buf);
            textlines.push(string);
      }
      //Pop the lines from the stack and print them:
      while(s=(char*)textlines.pop!=0){
            printf("s%",s);free(s);
      }
      textlines.cleanup();
    }
    2文件nested.cpp
    //—————————————————————————
    #include "nested.h"
    #include <stdlib.h>
    #include <assert.h>
    //—————————————————————————
    void stack::link::initialize(void* Data,link* Next){
      data=Data;
      next=Next;
    }
    //—————————————————————————
    void stack::initialize(){head=0;}
    //—————————————————————————
    void stack::push(void* Data){
        link* newlink=(link*)malloc(sizeof(link));
        assert(newlink);
        newlink->initialize(Data,head);
        head=newlink;
    }
    //—————————————————————————
    void stack::peek(){return head->data;}
    //—————————————————————————
    void stack::pop(){
        if(head==0){return 0;}
        void* result=head->data;
        link* oldHead=head;
        head=head->next;
        free(oldHead);
        return result;
    }
    //—————————————————————————
    void stack::cleanup(){
        link* cursor=head;
        while(head){
            cursor=cursor->next;
            free(head->data);
            free(head);
            head= cursor;
        }
    }
    3文件nested.h
    //—————————————————————————

    #ifndef NESTED_H_
    #define NESTED_H_
    struct stack{
        struct link{
            void* data;
            link* next;
            void initialize(void* Data,link* Next);
        }*head;
        void  initialize();
        void push(void* Data);
        void* peek();
        void* pop();
        void cleanup();
    }
    #endif //NESTED_H_
    编译如下:
    Build
      [C++ Error] _stddef.h(37): E2040 Declaration terminated incorrectly
      [C++ Error] _stddef.h(133): E2090 Qualifier 'std' is not a class or namespace name
      [C++ Error] _stddef.h(133): E2272 Identifier expected
      [C++ Error] _stddef.h(134): E2090 Qualifier 'std' is not a class or namespace name
      [C++ Error] _stddef.h(134): E2272 Identifier expected
      [C++ Error] _stddef.h(135): E2090 Qualifier 'std' is not a class or namespace name
      [C++ Error] _stddef.h(135): E2272 Identifier expected
      [C++ Error] _stddef.h(136): E2090 Qualifier 'std' is not a class or namespace name
      [C++ Error] _stddef.h(136): E2272 Identifier expected
      [C++ Error] stdio.h(150): E2316 'wint_t' is not a member of 'std'
      [C++ Error] stdio.h(150): E2040 Declaration terminated incorrectly
      [C++ Error] stdio.h(160): E2316 'wint_t' is not a member of 'std'
      [C++ Error] stdio.h(160): E2040 Declaration terminated incorrectly
      [C++ Error] stdio.h(163): E2316 'size_t' is not a member of 'std'
      [C++ Error] stdio.h(163): E2040 Declaration terminated incorrectly
      [C++ Error] stdio.h(174): E2316 'size_t' is not a member of 'std'
      [C++ Error] stdio.h(174): E2040 Declaration terminated incorrectly
      [C++ Error] stdio.h(199): E2316 'size_t' is not a member of 'std'
      [C++ Error] stdio.h(198): E2108 Improper use of typedef 'FILE'
      [C++ Error] stdio.h(198): E2451 Undefined symbol '__stream'
      [C++ Error] stdio.h(198): E2293 ) expected
      [C++ Error] stdio.h(202): E2316 'size_t' is not a member of 'std'
      [C++ Error] stdio.h(202): E2188 Expression syntax
      [C++ Error] stdio.h(203): E2293 ) expected
      [C++ Error] stdio.h(204): E2316 'size_t' is not a member of 'std'
      [C++ Error] stdio.h(204): E2228 Too many error or warning messages

    检查你的代码,拼写错误等.

    说了等于没说….

    [1]#define BUFSIZE 100——const int 100
    [2]strcop(string,buf)——-strcpy(string,buf)
    [3]//stack textlines与textlines.initialize();textlines未定义
    [4]File* file;————–FILE* file

    推荐一个错误一个错误的更改,比如Qualifier 'std' is not a class or namespace name,看的懂就基本知道什么错误了吧.

    首先不管是谁写的,一定要让我BS一下
    1  结构体 写完没有+ ;号
    2  头文件包含的乱七八糟 
      #include  <stdlib.h>
      #include  <assert.h>
    应该包含在 nested.h 里面
    3 函数的定义 和 声音 不一致,明明返回定义void* 结果返回值是 void
    4 pop函数的返回值 可能是地址 可能是 NULL
      与0比较 是不是比较挫?
    5 c语言里面文件的声明是 FILE *fp 如果不记得查帮助….
    6 最后我BS我自己,谁叫我这么闲?

    一下是我修改的结果
    #include "Unit2.h"
    #include  <stdio.h>
    #include  <stdlib.h>
    #include  <string.h>

    main(int argc,char** argv)
    {
      stack textlines;
      FILE* file;
      char* s;
      #define BUFSIZE 100
      char buf[BUFSIZE];
      assert(argc==2);
    //File name is argument
      textlines.initialize();
      file=fopen(argv[1],"r");
      assert(file);
    //Read File and store lines in the stack:
      while(fgets(buf,BUFSIZE,file)){
            char* string =(char*)malloc(strlen(buf)+1);
            assert(string);
            strcpy(string,buf);
            textlines.push(string);
      }
    //Pop the lines from the stack and print them:
      while(s=(char*)textlines.pop())
      {
            printf("s%",s);
            free(s);
      }
      textlines.cleanup();
    }

    #ifndef NESTED_H_
    #define NESTED_H_

    #include  <stdlib.h>
    #include  <assert.h>

    struct stack{
        struct link{
            void* data;
            link* next;
            void initialize(void* Data,link* Next);
        }*head;
        void  initialize();
        void push(void* Data);
        void* peek();
        void* pop();
        void cleanup();
    };
    #endif //NESTED_H_

    //—————————————————————————
    #include "Unit2.h"

    //—————————————————————————
    void stack::link::initialize(void* Data,link* Next)
    {
      data=Data;
      next=Next;
    }
    //—————————————————————————
    void stack::initialize(){head=0;}
    //—————————————————————————
    void stack::push(void* Data){
        link* newlink=(link*)malloc(sizeof(link));
        assert(newlink);
        newlink->initialize(Data,head);
        head=newlink;
    }
    //—————————————————————————
    void* stack::peek(){return head->data;}
    //—————————————————————————
    void* stack::pop(){
        if(head==0){return 0;}
        void* result=head->data;
        link* oldHead=head;
        head=head->next;
        free(oldHead);
        return result;
    }
    //—————————————————————————
    void stack::cleanup(){
        link* cursor=head;
        while(head){
            cursor=cursor->next;
            free(head->data);
            free(head);
            head= cursor;
        }

    在BCB60 环境下测试通过

  • Filed under: C++ Builder
  • 下面是BCB中TThread的Synchronize的定义:

    C/C++ code
    typedef void __fastcall (__closure *TThreadMethod)(void); … class DELPHICLASS TThread; class PASCALIMPLEMENTATION TThread : public System::TObject { … protected: … void __fastcall Synchronize(TThreadMethod Method); }

    下面是我的类中的相关定义

    C/C++ code
    class TMaxinThread : public TThread { public: typedef bool __fastcall (__closure *TMaxinThreadMethod)(void); __fastcall TMaxinThread(TMaxinThreadMethod method, char *threadName = NULL, bool bCreateSuspend = false); };

    但是实际上进行初始化的时候.编译无法通过:

    C/C++ code
    [C++ Error] MaxinEcho.cpp(51): E2285 Could not find a match for TMaxinThread::TMaxinThread(void,char *)

    为什么呢?

    C/C++ code
    //————————————————————————— #pragma hdrstop #include "Unit2.h" #include <Classes.hpp> #include <Dialogs.hpp> //————————————————————————— #pragma package(smart_init) typedef bool __fastcall (__closure *TMaxinThreadMethod)(void); class TMaxinThread : public TThread { public: __fastcall void Execute(){TThread::Execute();} __fastcall TMaxinThread(TMaxinThreadMethod method, char *threadName = 0, bool bCreateSuspend = false); }; __fastcall TMaxinThread ::TMaxinThread(TMaxinThreadMethod method, char *threadName , bool bCreateSuspend ):TThread(bCreateSuspend) { ShowMessage("Contructor for TMaxinThread"); } class XXX :public TComponent { private: //线程循环 TMaxinThreadMethod ThreadLoop; __fastcall XXX::XXX(TComponent* Owner); friend class TMaxinThread; }; __fastcall XXX::XXX(TComponent* Owner) : TComponent(Owner) { TMaxinThread *pThread=0; pThread = new TMaxinThread(ThreadLoop, "MaxinEchoThread",false); //[C++ Error] MaxinEcho.cpp(51): E2285 Could not find a match for ‘TMaxinThread::TMaxinThread(void,char *)’ }

    帮你修改了下,我个人觉得你的设计有点复杂,可以直接从TThread类派生嘛!

  • Filed under: C++ Builder
  • 编译一个不使用VCL的UNICODE程序,主程序入口是_tWinMain,在release_builds里面加上_UNICODE和UNICODE宏,编译时提示:
    [ILINK32 Error] Error: Unresolved external 'WinMain' referenced from D:\PROGRAM FILES\CODEGEAR\RAD STUDIO\5.0\LIB\C0W32.OBJ
    是的,我明白,定义了_UNICODE和UNICODE宏后,主程序入口为wWinMain,而C0W32.OBJ需要ansi版的程序入口,所以出现这个提示,UNICODE程序需要链接到C0W32W.OBJ。但是找了半天也找不到如何设置CB2007才能使程序链接到C0W32W.OBJ,在linker的Additional options里面加入C0W32W也不可以。
    请教了!!!

    不知道楼主是在哪里定义的UNICODE?建议在Project->Options…->Path and Defines->Coditional Defines加上";_UNICODE;UNICODE"(不包括双引号)

    等2008吧

    引用 2 楼 unsigned 的回复:
    不知道楼主是在哪里定义的UNICODE?建议在Project->Options…->Path and Defines->Coditional Defines加上";_UNICODE;UNICODE"(不包括双引号)

    就是在这里加的!不行!估计还有其他地方需要设置!

    那你可能得更新一下,我这里打了Patch23,是可以的。

    等待着好的版本~~

    ~~~~

    引用 5 楼 unsigned 的回复:
    那你可能得更新一下,我这里打了Patch23,是可以的。

    我的版本号是:11.0.2902.10471版本不够新吗?Patch23是新补丁吗?

    Patch23是最新补丁,主要还是看编译器的版本,dcc100.dll 11.0.2963.11001(patch23)

    已打patch23,dcc100.dll版本11.0.2963.11001,CB2007版本:11.0.2987.10779
    重新新建工程,问题依旧
    记得Turbo C++ 2006可以的。

    那就奇怪了,我新建任何一个工程没可以编译,里面写的比如MessageBox,也是对应的MessageBoxW

    好象是我搞错了,这上更新当中没有dcc100.dll,你可以看看bcbide100.bpl (pactch23 v11.0.2987.10779)

    ftp://H2Field:R4D2007@bekins1.borland.com/RADStudio2007Patch23.exe

    你试试这个test程序,打开UNICODE和_UNICODE宏
    ==============================================
    #include "windows.h"
    #include "tchar.h"

    int WINAPI _tWinMain(HINSTANCE,HINSTANCE,LPTSTR tszCmdLine,int nCmdShow){
    ::MessageBox(0,_T("OK"),_T("UNICODE TEST"),MB_OK);
    return 0;
    }

    C/C++ code
    #include "windows.h" #include "tchar.h" int WINAPI WinMain(HINSTANCE,HINSTANCE,LPSTR tszCmdLine, int nCmdShow){ ::MessageBox(0,_T("OK"),_T("UNICODE TEST"),MB_OK); return 0; }

    说明只认非Unicode的Command Line,不知道结果会如何。

    无法编译通过吧?设定了_UNICODE和UNICODE宏,ilink任然想链接到C0W32.OBJ(C0W32.lib),这就是问题的症结所
    在,链接到C0W32W.lib才是正确的,可是不知道怎么样设置才可以?郁闷

    不过你可以手工调用bcc32 带上参数 -WU /DUNICODE /D_UNICODE,但是在里面设置参数,无论如何也设置不上去。

    可能IDE真的无法设置,我想到一个丑陋的办法,就是把D:\PROGRAM FILES\CODEGEAR\RAD STUDIO\5.0\LIB\C0W32W.OBJ的名字改为C0W32.OBJ,骗过IDE,编译通过,结果正确,真郁闷!!!

    引用 18 楼 mopyman 的回复:
    可能IDE真的无法设置,我想到一个丑陋的办法,就是把D:\PROGRAM FILES\CODEGEAR\RAD STUDIO\5.0\LIB\C0W32W.OBJ的名字改为C0W32.OBJ,骗过IDE,编译通过,结果正确,真郁闷!!!

    这个确实是一个问题,即使我通过加上" -WU",它还是提示我错误,根据就无法覆盖掉。

    记得Turbo C++ 2006修改bpr文件可以解决这个问题

    用文本编辑器直接打开工程文件来修改

    引用 21 楼 fayfarn 的回复:
    用文本编辑器直接打开工程文件来修改

    C++Builder 2007应该修改工程文件的什么地方?我一直在找,没找到

    关注中。。。。。。。。。。

    CCRUN.COM上wskjuf的回答:
    ————————————————————–
    codegear似乎忘记在菜单的设置选项里添加入口main函数的可视化设置支持了,解决的方法有。

    1、命令行编译:

    C:\test>bcc32 -3 -P -c  -WC -WU file1.cpp

    C:\test>ilink32 -aa -c -Tpe  c0×32w.obj file1.obj,file1.exe,,import32.lib cw32mti.lib,,

    这里-WU和c0×32w提供了对console方式下unicode的支持。

    2、菜单方式:
    unicode和_unicode的声明并不影响入口main函数的形式,它只影响如MessageBox这些函数,如果它们被声明,就编译连接到W结尾的函数。影响main函数形式的设置在主工程文件里。

    bcb6:菜单Project-Edit Option Source,弹出project1.bpr.xml,改 <ALLOBJ value="c0×32.obj $(PACKAGES) $(OBJFILES)"/>这行就可以了。当然有时会改不成功,那只有关闭工程直接去改文件。

    2007:暂时没发现从菜单上就可以改的,但可以修改project1.cbproj:
    <PropertyGroup Condition="'$(Base)'!=''">
        <BCC_OptimizeForSpeed>true </BCC_OptimizeForSpeed>
        <OutputExt>exe </OutputExt>
        <DCC_CBuilderOutput>JPHNE </DCC_CBuilderOutput>
        <Defines>NO_STRICT </Defines>
        <DynamicRTL>true </DynamicRTL>
        <ILINK_ObjectSearchPath>test3 </ILINK_ObjectSearchPath>
        <ProjectType>CppConsoleApplication </ProjectType>
        <ILINK_StartupObjs>c0×32w.obj </ILINK_StartupObjs>

    插入最后那一行。之所以这么做,是因为2007采用了msbuild,有兴趣的自己看一看target文件。以前在论坛里已介绍了这部分的内容,现在就不废话了。

    改完之后,编译仍然会出现错误的提示,那是因为还没有设置-WU的缘故。有兴趣的看能不能解决吧。

    3、bcc32,ilink32还支持配置文件,事先写好后可以比1的方式更快的完成编译,诸如此类的方法,看得人眼花缭乱,各位选一种最适合自己的来使用就可以了。

    c0d32.obj    DLL startup module   

    c0d32w.obj    DLL startup module    Wide-char version

    c0d32x.obj    DLL startup module    no exception handling

    c0pkg32.obj    Package startup module   

    c0s32.obj    不明   

    c0w32.obj    GUI EXE startup module   

    c0w32w.obj    GUI EXE startup module    Wide-char version

    c0×32.obj    32-bit console-mode EXE startup module   

    c0×32w.obj    32-bit console-mode EXE startup module    Wide-char version
    ————————————————————————-
    看来真是个挺让人郁闷的问题!

    插入 <ILINK_StartupObjs>c0×32w.obj </ILINK_StartupObjs> 这个语句后,居然可以编译通过了,谢天谢地。

    等2008

  • Filed under: C++ Builder

  • 在别人电脑里编译可以运行,在我电脑里编译后,打开其中一个窗口,出现这问题,请问是什么问题?

    access violation at address 004BC664 in module 'planarc.exe'.Read of address 00000057.
    得刷新几次才能看到

    呃,很明显,你访问无效地址了.
    检查你的代码,看看有没有使用野指针.

    开了CodeGuard看看.

    数据库路径不对

    引用 3 楼 akirya 的回复:
    呃,很明显,你访问无效地址了.
    检查你的代码,看看有没有使用野指针.

    觉得你说得对,给分

  • Filed under: C++ Builder
  • 类别

    最新

    标签

    链接


    存档