Anonymous
How can i make a list of files to compile without adding every file to the arguments?
Use a build tool like make, cmake, meson, bazel2 etc etc ..
Anonymous
what? msvc has good support for header units
Read my message carefully before replying. I said MS added support for header units later. So if he was using a version prior to the one where the support was added, it is possible that he could be facing issues with header units
Anonymous
I was using g++ to compile it because gcc gives me an error
Know the difference between GCC and g++ before blindly switching between their usage.
Anonymous
later than what? i use header units at least 2 years
Later than when they started supporting standard library imports as modules using import std.core;
Stanislav
msvc provided experimental std modules before modules was standardized in C++20 import std; added only in C++23
Anonymous
you're kidding?
No I am not. MS went out of their way to support standard library imports before header units because this is what they anticipated would be the most troublesome change. This is why MS is far ahead of GCC and Clang. Supporting header units is a minor change after supporting scanning dependencies, inclusions and build order definitions. So MS made this change much faster while GCC and Clang went ahead with supporting header units and module partitions first and their support for the C++23 requirement of allowing imports of standard library components as modules instead of header units is still wanting.
Anonymous
msvc provided experimental std modules before modules was standardized in C++20 import std; added only in C++23
Microsoft supported import core; much earlier which is what has been changed to import std; now
Stanislav
Microsoft supported import core; much earlier which is what has been changed to import std; now
std.core and others was experimental modules, before standard modules, and they are osbsolete
Anonymous
std.core and others was experimental modules, before standard modules, and they are osbsolete
I know. Why are you making irrelevant points? My point was that MS supported std.core before header units. Now are u disagreeing with that?
Stanislav
I know. Why are you making irrelevant points? My point was that MS supported std.core before header units. Now are u disagreeing with that?
what ever, in the std.core time header units did not exists, because microsoft planned to drop macros at all you trying to compare different standards and technologies
Stanislav
why you didn't compare clang modules with header units? clang modules exists since forever
Anonymous
what ever, in the std.core time header units did not exists, because microsoft planned to drop macros at all you trying to compare different standards and technologies
No. Do you even understand what went behind the support for std.core? Microsoft made changes to support scanning dependencies, build order manifest generation and inclusion file order checks. All of this made them well placed to support the C++23 requirement of supporting import std; Once all these changes were made supporting header unit generation from header files was a minor change. I was merely suggesting that he could be using the version of Visual Studio which had support for std.core but not for header units. I wasn't saying that is the problem. I was suggesting that could be the case. From the information he gave, all we can do is infer why it could have failed.
Anonymous
why you didn't compare clang modules with header units? clang modules exists since forever
Clang modules is a feature that is different from the std.core feature in Visual Studio. Clang added this feature to move away from precompiled headers. This was very different from the modules feature added in C++20. Moreover his question was related to Visual studio. So I don't quite understand why I should make this comparison.
Anonymous
and std.core is different from std
Can you even read? When did I say they are the same? I said the changes required for supporting std.core is what made MS support import std; easily. If you are not sure read what MS did to support this feature, read more about it. std.core is much more closer to modules in C++20 than clang's module feature was
NazTfgh
Hi guys.
NazTfgh
Can someone please help me with my code?
NazTfgh
I have debug assertion failed error with a wizard generated code
ahmet
Cuz i get warning can somebody tell me what is markdown formatting
ahmet
Thx
Strife
I have never worked with Java and I am not familiar with this language But I want to know if it is true that they are very similar in oop discussion?
/
i thought they were both c compilers
/
i have tried using g++ *.cpp but it still doesnt work
/
it tells me undefined reference to `File::OpenFile(char const*)
/
this is the full source
/
https://pastebin.com/4db0AvRc
/
help
رغد🖤
Hello I have a problem that the c++ does not show me where it is wrong as usual. Can someone tell me what to do?
Suka
i have tried using g++ *.cpp but it still doesnt work
i guess you need to compile like this g++ -o main src/File.cpp main.cpp cmiiw
/
but now i get a new error
/
main.o:main.cpp:(.rdata$.refptr._ZTV4File[.refptr._ZTV4File]+0x0): undefined reference to `vtable for File'
/
i have also included fstream in the File class
Suka
Hello I have a problem that the c++ does not show me where it is wrong as usual. Can someone tell me what to do?
perhaps your syntax is ok but your logic is not? try compile simple error syntax like main.cpp func main() { fmt.Println("!... Hello World ...!") } hehe
/
try this g++ -o main -I src/ src/File.cpp main.cpp
now i get two errors: C:\Users\*\AppData\Local\Temp\ccGWovYT.o:main.cpp:(.rdata$.refptr._ZTV6STFile[.refptr._ZTV6STFile]+0x0): undefined reference to `vtable for STFile' and C:\Users\*\AppData\Local\Temp\ccGWovYT.o:main.cpp:(.rdata$.refptr._ZTV6STFile[.refptr._ZTV6STFile]+0x0): undefined reference to `vtable for File'
Anonymous
https://pastebin.com/4db0AvRc
g++ -o output File.cpp STFile.cpp main.cpp Add include guards for your header files as well.
Pavel
what are include guards for
https://www.geeksforgeeks.org/include-guards-in-c/
/
g++ -o output File.cpp STFile.cpp main.cpp
C:\Users\*\AppData\Local\Temp\ccpxt4Mi.o:File.cpp:(.rdata$.refptr._ZTV4File[.refptr._ZTV4File]+0x0): undefined reference to `vtable for File'
/
File.hpp change this virtual void ProcessFile(); -> virtual void ProcessFile(){};
#ifndef FILE_H #define FILE_H #include <fstream> class File { public: std::ifstream file; int OpenFile(const char *fname) {}; virtual void ProcessFile() {}; }; #endif // FILE_H
/
error: redefinition of 'int File::OpenFile(const char*)' 4 | int File::OpenFile(const char *fname) {
Suka
https://pastebin.com/UxU9kCxp
/
https://pastebin.com/UxU9kCxp
what do you edited here
/
it show now error here
the code you sent me shows that error?
/
try it first
yes i need to know what to copy
Suka
yes i need to know what to copy
copy all of them does it still show error? project/ main.cpp src/ File.hpp File.cpp STPFile.hpp STPFile.cpp g++ -I src/ src/File.cpp src/STFile.cpp main.cpp
Suka
what did you edited? and what that command does?
File.hpp: #include <fstream> class File { public: std::ifstream file; int OpenFile(const char *fname); virtual void ProcessFile(){}; <- this }; g++ -I ( I == also search this dir for library )
/
why you add the {}
Suka
why you add the {}
as far as i know virtual class function member must have body function and {} == empty body
Suka
so virtual function must always have an empty body?
not always is up to you. this is some example https://www.geeksforgeeks.org/virtual-function-cpp/
𝔖𝔞𝔯𝔬
Guys when you use ineheritance with std::vector<T> Does it inerehit also constructors?
Anonymous
Guys when you use ineheritance with std::vector<T> Does it inerehit also constructors?
Don't inherit from std::vector or any std types for that matter unless the type is specifically advertised for being inherited from (std::enable_shared_from_this). There is even a C++ guideline for this. You can search for it.
Anonymous
Hie can u convert kilometres to meters?
Anonymous
In .c
Anonymous
so virtual function must always have an empty body?
Unless it is a pure virtual function in which case it is ok for it to not have a body.
Anonymous