Author Topic: if dingux toolchain for windows dont support "C++"?  (Read 2667 times)

wy_scorpio (OP)

  • Posts: 368
if dingux toolchain for windows dont support "C++"?
« on: July 25, 2010, 07:27:40 am »
i try to write a "helloworld" program,it works now :)
but a question is "if dingux toolchain for windows dont support "C++"?"

i write code with "C++" below

#include <iostream>
using namespace std;
int main()
{
   cout<<"hello world!"<<endl;
   return 0;
}


and i use makefile to make hello.dge
makefile's content below

TOOLCHAINDIR := /dingux
BINPATH    := $(TOOLCHAINDIR)/bin
LIBPATH    := $(TOOLCHAINDIR)/lib

INCLUDES := -I${TOOLCHAINDIR}/mipsel-linux-uclibc/include

ARCH   := mipsel-linux-uclibc-
CC      := ${BINPATH}/$(ARCH)gcc
CFLAGS += $(shell $(BINPATH)/sdl-config --cflags)
LDFLAGS += $(shell $(BINPATH)/sdl-config --libs)

SOURCES := *.o

PROGRAM = hello
TARGET   := hello.dge
VERSION   =   1.0

all: $(PROGRAM)
   mv $(PROGRAM) $(TARGET)

clean:
   rm -f $(TARGET) *.o *~


but it appears errors


so i rewrite "helloworld" with "C"
code below:
#include <stdio.h>
int main()
{
   printf("hello world!\n");
   return 0;   
}


and i compile it with makefile
it make a hello.dge,and i test it on dingux succeed.

so ,i want to know "if dingux toolchain for windows dont support "C++"?"
who can help me?thanks
« Last Edit: July 25, 2010, 07:29:13 am by wy_scorpio »

darfgarf

  • Guest
Re: if dingux toolchain for windows dont support "C++"?
« Reply #1 on: July 25, 2010, 09:26:56 am »
The dingux toolchain (as in mipsel Linux uclibc) supports C++

SiENcE

  • Posts: 653
    • Crank Gaming (Dingux Apps)
Re: if dingux toolchain for windows dont support "C++"?
« Reply #2 on: July 25, 2010, 11:39:19 am »
Your Makefile is wrong.

You have to something like:

Code: [Select]
.cpp.o:
$(CCC) -c $(CCFLAGS) $*.cpp -o [email protected]

As i can read in your debug output, the only option that works is:

Code: [Select]
LDFLAGS += $(shell $(BINPATH)/sdl-config --libs)
The SDL Path is not set. You cannot only use
Code: [Select]
CFLAGS += $(shell $(BINPATH)/sdl-config --cflags)
You have to apply this CFLAGS to your compile session.

Also try something like:

Code: [Select]
CCFLAGS = $(CFLAGS)

Btw. you should read how Make works.

http://faculty.cs.byu.edu/~rodham/cs240/make-tutorial.html

wy_scorpio (OP)

  • Posts: 368
Re: if dingux toolchain for windows dont support "C++"?
« Reply #3 on: July 25, 2010, 12:21:25 pm »
Your Makefile is wrong.

You have to something like:

Code: [Select]
.cpp.o:
$(CCC) -c $(CCFLAGS) $*.cpp -o [email protected]

As i can read in your debug output, the only option that works is:

Code: [Select]
LDFLAGS += $(shell $(BINPATH)/sdl-config --libs)
The SDL Path is not set. You cannot only use
Code: [Select]
CFLAGS += $(shell $(BINPATH)/sdl-config --cflags)
You have to apply this CFLAGS to your compile session.

Also try something like:

Code: [Select]
CCFLAGS = $(CFLAGS)

Btw. you should read how Make works.

http://faculty.cs.byu.edu/~rodham/cs240/make-tutorial.html

thanks
i will try it...

wy_scorpio (OP)

  • Posts: 368
Re: if dingux toolchain for windows dont support "C++"?
« Reply #4 on: July 26, 2010, 04:30:30 pm »
Your Makefile is wrong.

You have to something like:

Code: [Select]
.cpp.o:
$(CCC) -c $(CCFLAGS) $*.cpp -o [email protected]

As i can read in your debug output, the only option that works is:

Code: [Select]
LDFLAGS += $(shell $(BINPATH)/sdl-config --libs)
The SDL Path is not set. You cannot only use
Code: [Select]
CFLAGS += $(shell $(BINPATH)/sdl-config --cflags)
You have to apply this CFLAGS to your compile session.

Also try something like:

Code: [Select]
CCFLAGS = $(CFLAGS)

Btw. you should read how Make works.

http://faculty.cs.byu.edu/~rodham/cs240/make-tutorial.html

 :(
i cant build a correct "makefile",if you can make a correct "makefile" which can compile "C++" code...and send it to me..
thanks very much!
« Last Edit: July 26, 2010, 04:34:57 pm by wy_scorpio »

SiENcE

  • Posts: 653
    • Crank Gaming (Dingux Apps)
Re: if dingux toolchain for windows dont support "C++"?
« Reply #5 on: July 26, 2010, 10:03:05 pm »
Mh. Why so compilcated?

type:
Code: [Select]
# mipsel-linux-uclibc-gcc hello.c -o hello.elf
then strip it to shorten:
Code: [Select]
# mipsel-linux-uclibc-strip.exe hello.elf
copy hello.elf to your dingoo and execute.

wy_scorpio (OP)

  • Posts: 368
Re: if dingux toolchain for windows dont support "C++"?
« Reply #6 on: July 27, 2010, 06:35:41 am »
Mh. Why so compilcated?

type:
Code: [Select]
# mipsel-linux-uclibc-gcc hello.c -o hello.elf
then strip it to shorten:
Code: [Select]
# mipsel-linux-uclibc-strip.exe hello.elf
copy hello.elf to your dingoo and execute.

thanks

 :D
i have succed compile a hello.dge with "C++"

the command below:
# mipsel-linux-uclibc-g++ -c hello.cpp -o hello.o
# mipsel-linux-uclibc-g++  hello.cpp -i. -o hello.dge


so,there must use "g++" to compile "C++ code"

 

Post a new topic