Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / compilation error

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. compilation error
#3783
Posted by: 2004-04-09 15:27:48
Sorry for my very basic English.....

Hi people,

My problem is :

I've installed DEV-C++ 4.9.8.7 by default, with package imagelib2, wxWidgets 242 and wxWidgets contrib242, on Win XP SP1.
The only modification that i've made is adding DEV-C++ in the "PATH".

I work with DEV-C++ since 10 days. I've made default window for wxWidgets, some Windows using wxFrame and wxDialog...without any problems.

Then i've found the Franky Braem's tutorial.

If i try to cut/copy the first prog "HelloWorld" with helloworld.h and helloworld.cpp in a new project, i cannot compile due an error...

I really don't no why....

Can you help me ??
Message2. Re: compilation error
#3786
Posted by: 2004-04-09 20:28:52
Create a wxWidgets Projekt.
I use the German version:
Datei-Neu-Projekt-GUI-wxWindows
My bad English Translation:
File-New-Project-GUI-wxWindows

Hope it?ll help.

Greetings from Munich.
Max
Message3. Re: compilation error
#3788
Posted by: 2004-04-09 21:35:18
thanks for help

I don't ahve problem to create project using wxWIdgets.

It's only with source files in Franky Braem's Tutorial.

Here is the .h File

**************************************************************************** 
#ifndef _HELLOWORLD_APP_H
#define _HELLOWORLD_APP_H

class HelloWorldApp : public wxApp
{
public:
       virtual bool OnInit();
protected:
private:
};

DECLARE_APP(HelloWorldApp)

#endif
*****************************************************************************

then the .cpp file

*****************************************************************************
#include "wx/wxprec.h"

#ifndef WX_PRECOMP
  #include "wx/wx.h"
#endif

#include "HelloWorldApp.h"

IMPLEMENT_APP(HelloWorldApp)

bool HelloWorldApp::OnInit()
{
  wxFrame *frame = new wxFrame((wxFrame*) NULL, -1, "Hello World");
  frame->CreateStatusBar();
  frame->SetStatusText("Hello World");
  frame->Show(TRUE);
  SetTopWindow(frame);
  return true;
}
*********************************************************************************
Error from compilator

[Build Error] *** multiple target patterns.  Stop.




Message4. Re: compilation error
#3792
Posted by: xburge03 2004-04-10 16:09:10
Hi!
Well, this sounds a bit wierd.
My guess: Try deleting the makefile.win in you project folder.
Check if you're using the correct version of make (if you're using MSYS too).
Check that you used the correct filenames and compiler settings.
I tried it just by myself and it compiled fine.
Message5. Re: compilation error
#3818
Posted by: 2004-04-13 16:38:23
HAaargh !!

I've send files .h and .cpp to another guy, and he compile it perfectly...and now it's the same for you...

It's very strange because, it works for me with other source code, I only have problem with source from Franky Braem tut !

(it's very pity because it's the best that i've found...If you know more good tut for wxWidgets, let me know...i'm looking for documentation about wxWidgets)

Is it possible to know your compilation setting and have a copy of make.win ??


Thanks you all guys
Message6. Re: compilation error
#3820
Posted by: 2004-04-13 17:04:53
Here is the compilation error
179 C:\Program Files\Dev-Cpp\include\wx\defs.h 
redeclaration of C++ built-in  type `bool

Here is my make.win file
 # Project: hello
# Makefile created by Dev-C++ 4.9.8.7

CPP  = g++.exe
CC   = gcc.exe
WINDRES = windres.exe
RES  = 
OBJ  = HelloWorldApp.o $(RES)
LINKOBJ  = HelloWorldApp.o $(RES)
LIBS =  -L"C:/Program Files/Dev-Cpp/lib" -mwindows 
INCS =  -I"C:/Program Files/Dev-Cpp/include" 
CXXINCS =  -I"C:/Program Files/Dev-Cpp/include/c++"  -I"C:/Program Files/Dev-Cpp/include/c++/mingw32"  -I"C:/Program Files/Dev-Cpp/include/c++/backward"  -I"C:/Program Files/Dev-Cpp/include" 
BIN  = hello.exe
CXXFLAGS = $(CXXINCS) 
CFLAGS = $(INCS) 

.PHONY: all all-before all-after clean clean-custom

all: all-before hello.exe all-after


clean: clean-custom
	rm -f $(OBJ) $(BIN)

$(BIN): $(OBJ)
	$(CPP) $(LINKOBJ) -o "hello.exe" $(LIBS)

HelloWorldApp.o: HelloWorldApp.cpp
	$(CPP) -c HelloWorldApp.cpp -o HelloWorldApp.o $(CXXFLAGS)

Maybe it will be easier to understanding....

Thanks a lot
Message7. Re: compilation error
#3825
Posted by: upCASE 2004-04-14 01:10:47
Hi!
Yes! This post actually helps, because the solution is right there... :)
You don't compile it as a wxWidgets projects, therefor no wxWidgets specific #defines are there, thus you get warnings about things like the type of bool, strings etc.
Use these as compiler settings:
-fno-rtti
-fno-exceptions
-fno-pcc-struct-return
-fstrict-aliasing
-Wall
-D__WXMSW__
-D__GNUWIN32__
-D__WIN95__

And these as linker settings (for wxWidgets 2.4.2):
-lwxmsw
-lole32
-lwsock32
-lcomctl32
-lctl3d32
-lgcc
-lstdc++
-lshell32
-loleaut32
-ladvapi32
-luuid
-lodbc32
-ltiff
-lpng
-ljpeg
-lzlib

Compile and have fun!
Tutorial: Well, I have thought of writing one myself. Maybe when my domain is up I'll start writing one like a blog, one topic covered a day. In the meantime, the one by Mr. Braem is really good. Too bad he never completed it.
upCASE
-----------------------------------
If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Message8. Re: compilation error
#3828
Posted by: 2004-04-14 15:15:03
Hoo I feel so sorry

 - Thanks for helping -

After modification, here is a copy of the make.win

# Project: Projet1
# Makefile created by Dev-C++ 4.9.8.7

CPP  = g++.exe
CC   = gcc.exe
WINDRES = windres.exe
RES  = 
OBJ  = HelloWorldApp.o $(RES)
LINKOBJ  = HelloWorldApp.o $(RES)
LIBS =  -L"C:/Program Files/Dev-Cpp/lib" -fno-rtti -fno-exceptions -fno-pcc-struct-return -fstrict-aliasing -Wall -fvtable-thunks -D__WXMSW__ -D__GNUWIN32__ -D__WIN95__ 

INCS =  -I"C:/Program Files/Dev-Cpp/include" 
CXXINCS =  -I"C:/Program Files/Dev-Cpp/include/c++"  -I"C:/Program Files/Dev-Cpp/include/c++/mingw32"  -I"C:/Program Files/Dev-Cpp/include/c++/backward"  -I"C:/Program Files/Dev-Cpp/include" 

BIN  = Projet1.exe

CXXFLAGS = $(CXXINCS)  -lwxmsw -lole32 -lwsock32 -lcomctl32 -lctl3d32 -lgcc -lstdc++ -lshell32 -loleaut32 -ladvapi32 -luuid -lodbc32 -ltiff -lpng -ljpeg -lzlib 
CFLAGS = $(INCS)  -lwxmsw -lole32 -lwsock32 -lcomctl32 -lctl3d32 -lgcc -lstdc++ -lshell32 -loleaut32 -ladvapi32 -luuid -lodbc32 -ltiff -lpng -ljpeg -lzlib 

.PHONY: all all-before all-after clean clean-custom

all: all-before Projet1.exe all-after


clean: clean-custom
	rm -f $(OBJ) $(BIN)

$(BIN): $(OBJ)
	$(CPP) $(LINKOBJ) -o "Projet1.exe" $(LIBS)

HelloWorldApp.o: HelloWorldApp.cpp
	$(CPP) -c HelloWorldApp.cpp -o HelloWorldApp.o $(CXXFLAGS)
The problem is the same !

Did i made something wrong ??

This simple code HelloWorld seems to work for other people, but i tried on two differents "standard" installation (under XP and NT4.0) and never compiling with success (no problem with other code I found on internet)...

What are the standards compilation-Links-project options settings ?
Were can i find a tutorial about Dev-Cpp seeting before use the compiler ??

Thanks peopole...


 
Message9. Re: compilation error
#3830
Posted by: 2004-04-14 16:30:05
It WORKS !!!

THANKS UPCASE !!

I add parameters you posted in C++ COMPILER,Linker, and specified Win32 GUI - all thoses in PROJECT/OPTION.

At first compilation send a "linker error".
It's boring me so I posted the reply above...continuing looking for a solution..

I just retry with same parameters, and it works !!

Thanks you everybody
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Fri 2024-3-29  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0