Eigenes Programmverzeichnis ermitteln
-
Husker schrieb:
über das Code Fragment bin ich auch schon gesolpert, leider bekomme ich das nicht ans laufen scheinbar hat er ein Problem mit der Deklaration
Das bezweifle ich, das Code Fragment habe ich gerade selber geschrieben.
Husker schrieb:
std::array<char,1000> path = {};
Type 'std::array<char,1000>' could not be resolved
Copy&paste vollständige Fehlermeldung
Copy&paste Kommandozeile CompilerMan kann auch ein simples C-Array verwenden.
-
ja mag sein, aber über:
https://www.computerbase.de/forum/showthread.php?t=1232719
bin ich schon gestolpert, ist nicht 100% gleich aber es nutzt auch readlink
hier das BuildLog
`13:06:45 **** Build of configuration Release for project macident ****
make all
Building file: ../src/MacObject.cpp
Invoking: Cross G++ Compiler
g++ -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/MacObject.d" -MT"src/MacObject.o" -o "src/MacObject.o" "../src/MacObject.cpp"
Finished building: ../src/MacObject.cpp
Building file: ../src/SQLiteDatabase.cpp
Invoking: Cross G++ Compiler
g++ -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/SQLiteDatabase.d" -MT"src/SQLiteDatabase.o" -o "src/SQLiteDatabase.o" "../src/SQLiteDatabase.cpp"
Finished building: ../src/SQLiteDatabase.cpp
Building file: ../src/macident.cpp
Invoking: Cross G++ Compiler
g++ -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/macident.d" -MT"src/macident.o" -o "src/macident.o" "../src/macident.cpp"
In file included from /usr/include/c++/5/array:35:0,
from ../src/macident.cpp:26:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support \
^
../src/macident.cpp: In function ‘int main(int, char**)’:
../src/macident.cpp:44:2: error: ‘array’ was not declared in this scope
array<char,1000> path = {};
^
../src/macident.cpp:44:8: error: expected primary-expression before ‘char’
array<char,1000> path = {};
^
../src/macident.cpp:46:30: error: ‘path’ was not declared in this scope
readlink( "/proc/self/exe", path.data(), path.size());
^
src/subdir.mk:24: die Regel für Ziel „src/macident.o“ scheiterte
make: *** [src/macident.o] Fehler 1
13:06:50 Build Finished (took 5s.58ms)`
-
#error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
Entweder du schaltest C++11 oder höher ein (für das komplette Projekt) oder du benutzt C-Arrays.
-
Schau dir doch an wie das tool lspci macht.
Diese verwendet auch eine art DB für das mapping PCIID zu Namen
AFAIK liegt diese DB unter /usr/local/share/
-
c++ 11 habe ich auch schon eingeschaltet nach dem Post natürlich, brachte aber keine besserung, die FM kommt nicht mehr beim Bauen, aber die Fehler im Code bleiben
[Eclipse]
Properties -_> C7C++ Builder --> Settings --> Tool Settings -->Cross GCC Compiler --> Miscellaneous --> Other Flags: -c -fmessage-length=0 -std=c++11
-
firefly schrieb:
Schau dir doch an wie das tool lspci macht.
Diese verwendet auch eine art DB für das mapping PCIID zu Namen
AFAIK liegt diese DB unter /usr/local/share/okay wird gemacht
-
Husker schrieb:
die FM kommt nicht mehr beim Bauen,
Ok
Husker schrieb:
aber die Fehler im Code bleiben
Was willst du damit sagen?
-
keinen ahung, der C++ Compiler und ich sind noch keine Freunde,
bauen liess sich das Projekt komischer weise aber beims tarten kommt jetzt der gleiche scheiß inkl der c++11 FM13:29:07 **** Clean-only build of configuration Debug for project macident ****
make clean
rm -rf ./src/MacObject.o ./src/SQLiteDatabase.o ./src/macident.o ./src/MacObject.d ./src/SQLiteDatabase.d ./src/macident.d macident13:29:08 Build Finished (took 1s.421ms)
13:29:08 **** Incremental Build of configuration Debug for project macident ****
make all
Building file: ../src/MacObject.cpp
Invoking: Cross G++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/MacObject.d" -MT"src/MacObject.o" -o "src/MacObject.o" "../src/MacObject.cpp"
Finished building: ../src/MacObject.cppBuilding file: ../src/SQLiteDatabase.cpp
Invoking: Cross G++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/SQLiteDatabase.d" -MT"src/SQLiteDatabase.o" -o "src/SQLiteDatabase.o" "../src/SQLiteDatabase.cpp"
Finished building: ../src/SQLiteDatabase.cppBuilding file: ../src/macident.cpp
Invoking: Cross G++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/macident.d" -MT"src/macident.o" -o "src/macident.o" "../src/macident.cpp"
In file included from /usr/include/c++/5/array:35:0,
from ../src/macident.cpp:26:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support \
^
../src/macident.cpp: In function ‘int main(int, char**)’:
../src/macident.cpp:44:2: error: ‘array’ is not a member of ‘std’
std::array<char,1000> path = {};
^
../src/macident.cpp:44:13: error: expected primary-expression before ‘char’
std::array<char,1000> path = {};
^
../src/macident.cpp:46:30: error: ‘path’ was not declared in this scope
readlink( "/proc/self/exe", path.data(), path.size());
^
src/subdir.mk:24: die Regel für Ziel „src/macident.o“ scheiterte
make: *** [src/macident.o] Fehler 113:29:13 Build Finished (took 4s.647ms)
-
manni66 schrieb:
Husker schrieb:
die FM kommt nicht mehr beim Bauen,
Ok
Husker schrieb:
aber die Fehler im Code bleiben
Was willst du damit sagen?habes jetzt erstmal so gelöst:
char buf[255]; readlink("/proc/self/exe", buf, sizeof(buf)); std::cout << buf << std::endl;
startet tuts, muss jetzt schauern wie sich das bei den unterscheidlichen aufrufen verhält
-
Der Compiler wird immer noch nicht mit dem C++11 flag aufgerufen. Da steht doch mit welche Optionen der aufgerufen wird. Wo man das in den Eclipse Einstellungen setzt, weiß ich nicht, aber du scheinst da was falsch zu machen.