#Multi-file compiling

42 messages · Page 1 of 1 (latest)

tranquil coral
#

Hi.
I'm looking for a way to get the compiler I'm using (visual studio) to compile all the .cpp and header files, but As you can see in the picture I attached, it keeps giving me the error "[build] Build finished with exit code 1" and "No program will be executed"; what do I do?

For this simple exercise, I'm using VS Code along with Cmake.

pine cliffBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

halcyon notch
#

It looks like you have all the files there for use with Visual Studio 2022

#

Was this a Visual Studio Project?

tranquil coral
hushed isle
halcyon notch
#

Oh lol

#

you need to add all the sources in the CMakeLists file

tranquil coral
halcyon notch
#

Then tbh if you aren't using vs2022/msbuild i would just use ninja or something

hushed isle
halcyon notch
#

Yeah that ^ tbh

#

you'll have alot more of a pain free experiance

hushed isle
#

You can open a CMake project in VS directly and build it, the IDE will figure out all the plumbing needed.

tranquil coral
halcyon notch
#

Well you need to make sure all your sources are added and compiled

hushed isle
tranquil coral
hushed isle
#

Problem cascade yamikek

halcyon notch
#

add_executable(my_exe file1.cpp file2.cpp file3.cpp)

tranquil coral
#

I can see that VSCode sucks

halcyon notch
#

What are the unresolved symbols?

#

VSCode doesn't suck

#

it's just a pain to set up

hushed isle
tranquil coral
#

Understood

hushed isle
#

FWIW I use VSCode as my main editor on Linux, so it's quite capable, but warrants an existing understanding of how builds work, how CMake works, etc.

halcyon notch
#

Yeah I use vscode for Linux and some other stuff too. VS i just use for windows

tranquil coral
halcyon notch
#

Yeah seems like you're not including those files then in CMake

hushed isle
#

You probably haven't added the source files where these are defined to the CMake script.

#

Show the project file structure and CMake script.

tranquil coral
#

so how do I add them to cmake list?

apologize If I'm taking your time

tranquil coral
#

sorry, right away give me asec plz

#

aapologize for the delay

pine cliffBOT
#
karnage42
Please Do Not Send Screenshots!

They're hard to read and prevent copying and pasting.

halcyon notch
#

all the files you want compiling put in the add_executable directive

#

in you case it is at least add_executable(GUIHello main.cpp Car.cpp)

tranquil coral