C++ mit CooCox

#3266037
Lesenswert?

Michael Frangenberg schrieb:
> Eine main.cpp anlegen und kompilieren. Klingt zwar doof, aber bei mir
> hat das direkt funktioniert. Ich wollte nämlich mal testen, ob sich die
> Eigen3 Bibliothek auf dem STM32F4 bauen lässt und ja, es geht.

Macht kein Unterschied :-(

[cc] C:\CooCox\CoIDE\workspace\TESTCPlusPlus\main.c:3:1: error: unknown 
type name 'class'
[cc] C:\CooCox\CoIDE\workspace\TESTCPlusPlus\main.c:4:1: error: expected 
'=', ',', ';', 'asm' or '__attribute__' before '{' token
#3266049
Lesenswert?

holger schrieb:
>>Eine main.cpp anlegen
>
> Was hast du daran nicht verstanden eine main.cpp
> anzulegen und keine main.c?
>
>>main.c :3:1: error: unknown
>>type name 'class'

Das hab ich schon verstanden, Holger :-)

Leider hat das einfache umbenennen im Projektexplorer nichts gebracht. 
Hatte dann nicht gesehen das er noch die "alte" .c nimmt.

Also einfach nicht genau hin geschaut.
#3266067
Lesenswert?

Jetzt nimmt er zwar die C++ Befehle aber die anderen Sachen laufen nicht 
mehr :-(.

[cc] arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -g -nostartfiles 
"-Wl,-Map=UART Test.map" -O0 -Wl,--gc-sections 
"-LC:\CooCox\CoIDE\configuration\ProgramData\UART Test" 
"-Wl,-TC:\CooCox\CoIDE\configuration\ProgramData\UART 
Test/arm-gcc-link.ld" -g -o '"UART Test.elf"' ..\obj\stm32f4xx_syscfg.o 
..\obj\stm32f4_discovery_audio_codec.o ..\obj\stm32f4xx_usart.o 
..\obj\stm32f4xx_dac.o ..\obj\startup_stm32f4xx.o 
..\obj\stm32f4_discovery.o ..\obj\main.o ..\obj\stm32f4xx_rcc.o 
..\obj\stm32f4xx_gpio.o ..\obj\system_stm32f4xx.o ..\obj\stm32f4xx_dma.o 
..\obj\stm32f4_discovery_callbacks.o ..\obj\stm32f4xx_spi.o 
..\obj\stm32f4xx_i2c.o ..\obj\stm32f4xx_exti.o ..\obj\misc.o 
..\obj\stm32f4_discovery_lis302dl.o -L..\..\..\STM32F4-Discovery 
-lpdmfilter_gcc

[cc] c:/program files (x86)/gnu tools arm embedded/4.7 
2013q2/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib/ 
armv7e-m\libg.a(lib_a-abort.o):  In function `abort':

[cc] abort.c:(.text.abort+0xa): undefined reference to `_exit'

[cc] c:/program files (x86)/gnu tools arm embedded/4.7 
2013q2/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib/ 
armv7e-m\libg.a(lib_a-signalr.o):  In function `_kill_r':

[cc] signalr.c:(.text._kill_r+0xe): undefined reference to `_kill'

[cc] c:/program files (x86)/gnu tools arm embedded/4.7 
2013q2/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib/ 
armv7e-m\libg.a(lib_a-signalr.o):  In function `_getpid_r':

[cc] signalr.c:(.text._getpid_r+0x0): undefined reference to `_getpid

[cc] collect2.exe: error: ld returned 1 exit status
Gast #3300050
Lesenswert?

Wo kann man das machen in CooCox?

Eigentlich nahc meiner Meinung sollte man noch g++ anstatt gcc 
einstellen.
Aber habe ich nicht geschaft..

Main.cpp
=============
class A{

};

int main(void){
    while(1)
    {
    }
}

kriege ich

GCC HOME: D:\privat\_stm32\toolchains\GNU Tools ARM Embedded\4.7 
2013q2\bin
compile:
    [mkdir] Created dir: 
D:\programs\CooCox\CoIDE\workspace\Test_CPP_makefile\Test_CPP_makefile\D 
ebug\bin
    [mkdir] Created dir: 
D:\programs\CooCox\CoIDE\workspace\Test_CPP_makefile\Test_CPP_makefile\D 
ebug\obj
       [cc] 1 total files to be compiled.
       [cc] arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Wall 
-ffunction-sections -g -O0 -c -DSTM32F103RB -DSTM32F10X_MD 
-ID:\programs\CooCox\CoIDE\workspace\Test_CPP_makefile 
D:\programs\CooCox\CoIDE\workspace\Test_CPP_makefile\main.c
       [cc] 
D:\programs\CooCox\CoIDE\workspace\Test_CPP_makefile\main.c:1:1: error: 
unknown type name 'class'
       [cc] 
D:\programs\CooCox\CoIDE\workspace\Test_CPP_makefile\main.c:1:8: error: 
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token

BUILD FAILED
Total time: 0 seconds
Gast #3300103
Lesenswert?

meloun schrieb:
> D:\programs\CooCox\CoIDE\workspace\Test_CPP_makefile\main.c
Das ist eine C-Datei. C kennt keine Klassen. Nehme die Datei aus dem 
Projekt, benenne sie in main.cpp um, füge sie wieder hinzu, Coocox 
sollte sie dann als C++ erkennen.
Das kommt davon wenn man mit Klickibunti-IDE's arbeitet die alles 
wichtige irgendwo verstecken... Bei makefiles weiß man immer wo man 
Flags & Kommandos ablegen muss.

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren